Skip to content

Commit

Permalink
also include page lookup for URN
Browse files Browse the repository at this point in the history
  • Loading branch information
ikreymer committed Feb 14, 2025
1 parent fca2a3c commit 0c478ad
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/wacz/multiwacz.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1334,12 +1334,24 @@ export class MultiWACZ
names = [...this.preloadResources];
}

let pageUrl;

// if top-level doc, and has page query, query for which WACZ files should be tried
if (
this.pagesQueryUrl &&
(request.destination === "document" || request.destination === "iframe")
) {
const res = await this.getWACZFilesForPagesQuery(request.url);
pageUrl = request.url;
// thumbnail or other custom resource for page, lookup corresponding page url
} else if (this.pagesQueryUrl && request.url.startsWith("urn:")) {
const inx = request.url.indexOf("http");
if (inx > 0) {
pageUrl = request.url.slice(inx);
}
}

if (pageUrl) {
const res = await this.getWACZFilesForPagesQuery(pageUrl);
if (res) {
names = [...names, ...res];
return names;
Expand Down

0 comments on commit 0c478ad

Please sign in to comment.