logseq
logseq copied to clipboard
fix(pdf): incorrect filename encoding
When loading a document, the pdf.js library parses the URL for specific parameters (for example, #page=2&zoom=200).
Therefore, in order to open a PDF file with the name file#1.pdf, the URL should look like file:///home/user/documents/file%231.pdf or file:///home/user/documents/file%231.pdf#page=2&zoom=200.
I found some related information in their repository: https://github.com/mozilla/pdf.js/wiki/Viewer-options
fixes #4401 fixes #4859 fixes #8533
Related #8792, I'll QA this when it gets merged.
This should be a feature request to add support for viewer options for PDF links.
Currently, the #fragment part is treated as part of a filename. So this fix will introduce more mess to PDF handling(trying to add a buggy path handing to a buggy assets url handing, in order to pass #fragment URL to pdf.js)
@xyhp915
I find that even using a file:// link, (:file-path (:block/properties page)) is saved without file://. No clue where the actual code is.
PDF view-options like #page=2&zoom=200 should not be used in PDF assets links. Logseq tracks current PDF page numbering using its own property.
Better use the highlight tools to link to any desired page.
Mark this as hold, as fragment URL support is not planned for PDF view.
CC @xyhp915