Skip to content

Commit 4089240

Browse files
committed
Adjusted logic to ZIP
1 parent 5413017 commit 4089240

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

src/viewer.js

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -467,17 +467,35 @@ export class Viewer {
467467

468468
// Set up URL modifier to use extracted files
469469
MANAGER.setURLModifier((assetUrl, path) => {
470+
console.log('URLModifier called with:', { assetUrl, path });
471+
470472
// Decode the URL in case it's encoded
471473
const decodedUrl = decodeURI(assetUrl);
472474

473-
// Check if we have this file in our extracted files
475+
// Extract just the filename from the URL
476+
const fileName = decodedUrl.split('/').pop().split('?')[0];
477+
478+
console.log('Looking for file:', fileName, 'in extracted files:', Array.from(extractedFiles.keys()));
479+
480+
// Check if we have this file in our extracted files (by filename)
481+
if (extractedFiles.has(fileName)) {
482+
const file = extractedFiles.get(fileName);
483+
const blobURL = URL.createObjectURL(file);
484+
blobURLs.push(blobURL);
485+
console.log('Found file in ZIP, using blob URL:', blobURL);
486+
return blobURL;
487+
}
488+
489+
// Also check with the full decoded URL
474490
if (extractedFiles.has(decodedUrl)) {
475491
const file = extractedFiles.get(decodedUrl);
476492
const blobURL = URL.createObjectURL(file);
477493
blobURLs.push(blobURL);
494+
console.log('Found file in ZIP (full path), using blob URL:', blobURL);
478495
return blobURL;
479496
}
480497

498+
console.log('File not found in ZIP, using original URL:', assetUrl);
481499
// If not found, return the original URL
482500
return assetUrl;
483501
});

0 commit comments

Comments
 (0)