mirror of
https://github.com/ArchiveBox/ArchiveBox.git
synced 2026-04-25 17:16:00 +03:00
[GH-ISSUE #762] Question: properly save PDF from URLs without .pdf extension #483
Labels
No labels
expected: maybe someday
expected: next release
expected: release after next
expected: unlikely unless contributed
good first ticket
help wanted
pull-request
scope: all users
scope: windows users
size: easy
size: hard
size: medium
size: medium
status: backlog
status: blocked
status: done
status: idea-phase
status: needs followup
status: wip
status: wontfix
touches: API/CLI/Spec
touches: configuration
touches: data/schema/architecture
touches: dependencies/packaging
touches: docs
touches: js
touches: views/replayers/html/css
why: correctness
why: functionality
why: performance
why: security
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/ArchiveBox#483
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @philippemilink on GitHub (Jun 5, 2021).
Original GitHub issue: https://github.com/ArchiveBox/ArchiveBox/issues/762
(perhaps this is a feature request)
If I save a web page serving a PDF file (such as https://www.debian.org/doc/manuals/packaging-tutorial/packaging-tutorial), the "wget > HTML" preview displays the listing of the folder containing the save. I have to go through the "See all files..." and browse the folder tree to get the file. Moreover, since the file has no extension, the browser considers it as
application/octet-streamfile, and doesn't open it directly in the browser as it does normally.With URL including the
.pdfextension, the preview works fine.Is there a way to make it work for all URLs serving PDF files (with and without the extension) ?
If not, may I suggest a feature adding the
pdfextension to the saved file (and the saved URL) if it appears the saved file is a PDF ? (it could be done by looking at theContent-Typeheader)@pirate commented on GitHub (Jun 10, 2021):
This is a known shortcoming of how static files are saved and replayed by the WGET extractor, see here: https://github.com/ArchiveBox/ArchiveBox/blob/dev/archivebox/extractors/wget.py#L179
Likely not going to fix this, as we want to avoid rewriting the URLs to be different in the filesystem than how they are served (as much as possible). The one place we do rewrite URLs is to add
.htmlon the end, and that's already one of the gnarliest most difficult-to-maintain pieces of code in the entire codebase, so I'm not going to add another edge case there.We also don't serve MIME headers with wget-downloaded content, so we aren't able to replicate they way they serve PDF mime content from a non
.pdfURL extension. We can't safely replicate that yet, so any non-HTML content is served asapplication/octet-stream.Debian should serve
.pdfon the end of their URL or redirect to a.pdfURL from the non-pdf one instead of serving PDF mime content from a non-PDF extension. Bending over backwards to support that type of weirdness will introduce too much complexity and break other areas of ArchiveBox.