diff --git a/src/collection.ts b/src/collection.ts index 6ceb8d7..ffc89a2 100644 --- a/src/collection.ts +++ b/src/collection.ts @@ -389,7 +389,7 @@ export class Collection { return response; } - const opts = { pageId: query.pageId }; + const opts = { pageId: query.pageId, noRedirect: query.isProxyOrigin}; response = await this.store.getResource(query, this.prefix, event, opts); diff --git a/src/request.ts b/src/request.ts index 018f7c5..7339c0f 100644 --- a/src/request.ts +++ b/src/request.ts @@ -11,6 +11,8 @@ export class ArchiveRequest { hash = ""; cookie = ""; + isProxyOrigin = false; + request: Request; method: string; mode: string; @@ -66,6 +68,7 @@ export class ArchiveRequest { if (url.origin === localOrigin) { this.url = proxyOrigin + url.pathname + (url.search ? url.search : ""); } + this.isProxyOrigin = true; } const hashIndex = this.url.indexOf("#"); diff --git a/src/wacz/multiwacz.ts b/src/wacz/multiwacz.ts index 63d3d0e..27a7f34 100644 --- a/src/wacz/multiwacz.ts +++ b/src/wacz/multiwacz.ts @@ -1049,7 +1049,7 @@ export class MultiWACZ event: FetchEvent, // [TODO] // eslint-disable-next-line @typescript-eslint/no-explicit-any - { pageId }: Record = {}, + { pageId, noRedirect }: Record = {}, ): Promise { await this.initing; @@ -1097,6 +1097,9 @@ export class MultiWACZ loadFirst: true, }); if (resp) { + if (noRedirect) { + return resp; + } foundMap.set((resp as ArchiveResponse).date, { name, hash: file.hash }); } }