diff --git a/app/src/components/Archive.js b/app/src/components/Archive.js index 6386a6cd..e8de0e7e 100644 --- a/app/src/components/Archive.js +++ b/app/src/components/Archive.js @@ -34,6 +34,7 @@ import { mimetypeColor, PageContainer, PreviewPath, + resolveDataPath, SearchInput, SortButton, TabLinks, @@ -104,11 +105,16 @@ function ArchivePage() { } - const {data, size} = archiveFile; + const {data, size, directory} = archiveFile; - const singlefileUrl = data.singlefile_path ? `/media/${encodeMediaPath(data.singlefile_path)}` : null; - const readabilityUrl = data.readability_path ? `/media/${encodeMediaPath(data.readability_path)}` : null; - const screenshotUrl = data.screenshot_path ? `/media/${encodeMediaPath(data.screenshot_path)}` : null; + // Resolve data paths (filename-only) to full relative paths using directory + const singlefilePath = resolveDataPath(data.singlefile_path, directory); + const readabilityPath = resolveDataPath(data.readability_path, directory); + const screenshotPath = resolveDataPath(data.screenshot_path, directory); + + const singlefileUrl = singlefilePath ? `/media/${encodeMediaPath(singlefilePath)}` : null; + const readabilityUrl = readabilityPath ? `/media/${encodeMediaPath(readabilityPath)}` : null; + const screenshotUrl = screenshotPath ? `/media/${encodeMediaPath(screenshotPath)}` : null; const singlefileButton =