Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[stable20] Fix opening PDF files with special characters in their name #298

Merged
merged 1 commit into from
Jan 28, 2021

Conversation

backportbot-nextcloud[bot]
Copy link

@backportbot-nextcloud backportbot-nextcloud bot commented Jan 28, 2021

⚠️ This backport had conflicts and is incomplete ⚠️

backport of #291

Before the move to the viewer the URL of the PDF file to load was got
using "Files.getDownloadUrl()", which encodes each section of the path
as a URI component. The full URL, in turn, was again encoded as a URI
component to set the source of the iframe in which the PDF viewer is
loaded. When the PDF viewer parsed the URL it decoded it once, so each
section of the path was still encoded as a URI component.

After the move to the viewer the URL of the PDF file to load was got
from the "davPath" property set by the viewer, which uses the filename
as is. The full URL was then encoded as a URI component, so when the PDF
viewer parsed and decoded the URL the raw filename was used. In most
cases it worked fine, but if the filename included some special
character, like "?", the file failed to load.

Now, instead of using the "davPath" property set by the viewer, each
section of the dav path is encoded as a URI component. The encoding
tries to not make any assumption on the format used by the viewer to
avoid being coupled too much.

Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
Copy link
Member

@danxuliu danxuliu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested and works 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants