Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions src/sw.ts
Original file line number Diff line number Diff line change
Expand Up @@ -564,6 +564,8 @@ async function fetchHandler ({ path, request, event }: FetchHandlerArg): Promise
}
/**
* abort the signal after the configured timeout.
*
* @see https://github.com/ipfs/service-worker-gateway/issues/674
*/
const signalAbortTimeout = setTimeout(() => {
abortFn({ type: 'gateway-timeout' })
Expand All @@ -572,11 +574,12 @@ async function fetchHandler ({ path, request, event }: FetchHandlerArg): Promise
event.request.signal.addEventListener('abort', abortFn)

try {
/**
* @see https://github.com/ipfs/service-worker-gateway/issues/674
*/
const url = new URL(event.request.url)
// remove the query params and hash fragment as verified-fetch/ipfs don't care about them
url.search = ''
url.hash = ''

const response = await verifiedFetch(event.request.url, {
const response = await verifiedFetch(url.href, {
signal,
headers,
redirect: 'manual',
Expand Down
Loading