-
Notifications
You must be signed in to change notification settings - Fork 44
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
Can't open PDF when filename or folder name contains a space or special character (' ', é, ...) #381
Comments
Same issue here |
@beardhatcode, can you reproduce the double encoding? |
Yes, I was able to reproduced it last week |
(I tested in Firefox btw) |
We also have the problem with version 21.0.2 Tested in Firefox and Chrome, also in the backend nginx or Apache2, unfortunately always the same error. As soon as the file has a space, it does not open it. It works fine without spaces. |
Actually anything that generates a % in the URL. like Umlauts, #, ?, spaces etc... causes this error. A file named "#PDF mit Abständen und Umlauten.pdf" produces the following error message: Message: Missing PDF "https://cloud.mydomain.tld/remote.php/dav/files/user/%2523PDF%2520mit%2520Abst%25C3%25A4nden%2520und%2520Umlauten.pdf". This also happens if the name of a parent folder contains any of these characters or spacing. |
Did you all use php8? |
No, I'm using the below PHP version:
|
I have the same issue now with NC20.0.10 and NC21.0.2 |
No, NC 21.0.2 with the following PHP version here: |
Here we have the same issue with NC 21.0.2 (PHP 7.4.18). To help the students of my school tomorrow, I switched to OnlyOffice as the default PDF viewer as a workaround. But I wonder how this bug could slip through with the release of 21.0.2. |
cc @nextcloud/server-triage |
Same issue here Nextcloud 20.0.10 Operating System: | Linux 5.4.0-1035-raspi aarch64 Nginx version: nginx/1.18.0 (Ubuntu) Database PHP |
PHP 7.4.9 |
Same here with PHP 7.4.18 -> NC 21.0.2 Obviously it is not nexcessary that the PDF Filename contains Spaces - one space in the whole path is causing the error So not just ../My Name.PDF but also /this.is/my path/to.the.file/My-Name.PDF causes the error |
@skjnldsv , I think it will likely suffice to remove the encode here: files_pdfviewer/src/views/PDFView.vue Line 61 in 487c93f
The davpath that is returned by viewer is now already "safe" so there is no need to encode it again. I might try this out tonight. |
How can I test this? |
@Zniets, you could edit that file and change the aforementioned line to Alternatively, I you don't want to compile, you could edit !==i[a]&&(c+="/"+encodeURIComponent(i[a]));return t&&(c=i[0]+"//"+i[2]+c),c}} to !==i[a]&&(c+="/"+i[a]);return t&&(c=i[0]+"//"+i[2]+c),c}} Or even simpler: Just replace If you try this out, could you report back if that solved the issue? Thanks 🙂 |
it helped, thanks! |
@DmDS, do you mean that the proposed edit resolved the issue completely? |
yes) |
This worked for me |
I can confirm it works again with the change, after clearing the browser cache. |
@beardhatcode confirmed it fixed the problem. thanks a lot. :) |
confirmed fixed, after update to 20.0.10 cant open pdf, but after i tried this is now working . Thank You Sir |
Thank you so much for the help. The bugfix works! In the future it would be nice if the functions of the app were tested before a new update is rolled out. |
The fix for this issue is not yet merged, to help others find this out I'll reopen the issue |
Any idea of timescale when this will be available as a release for NC20.x (currently on v2.0.1) that can be installed as an update from within NC for those of us who don't have sudo access to the server? Its a right pain at present - we've had to switch pdf viewing to OpenOffice and it is so slooow. (we have loads of pdf files and folder names with spaces and all was good till we updated to NC20.x this week) |
This fix repair opening my own PDF files, but does not solve opening shared PDF files. |
@aleskomarek did you replace the entire file or just the did you just do the mini edit? |
without file replacement or file edition |
@aleskomarek wait you said that without any fix you have working pdf viewer from cloud but not from shared link? |
sorry for my inaccuracy, i uploaded PDF file to my account and with this fix I opened this file in buildin PDF viewer, but when I shared this file to another user and this user opens this shared file in buildin PDF viewer problem persists - file is missing |
@aleskomarek , could you ask that other user to clear their browser cache? They are likely still using the old code. |
I'm have shared folder to another user and I moved a PDF file to this shared folder. Another user has problem with opening this PDF file in buildin PDF viewer. In NC version 21.0.1 this was ok. |
You are right. Now this is also functional over shared folder/file. Trouble was really in user's web browser. After restart browser and clear cache this is ok. I apologize for my fault. |
The errors that required encodeURIComponent in the past have been mittigated by the following commit on nextcloud viewer. nextcloud/viewer@02e1b1a The code with hasScheme may be removed, viewer now returns a full properly encoded URI thanks to the work done in nextcloud-router fixes #381 Signed-off-by: Robbert Gurdeep Singh <git@beardhatcode.be>
The errors that required encodeURIComponent in the past have been mittigated by the following commit on nextcloud viewer. nextcloud/viewer@02e1b1a The code with hasScheme may be removed, viewer now returns a full properly encoded URI thanks to the work done in nextcloud-router fixes #381 Signed-off-by: Robbert Gurdeep Singh <git@beardhatcode.be>
The errors that required encodeURIComponent in the past have been mittigated by the following commit on nextcloud viewer. nextcloud/viewer@02e1b1a The code with hasScheme may be removed, viewer now returns a full properly encoded URI thanks to the work done in nextcloud-router fixes #381 Signed-off-by: Robbert Gurdeep Singh <git@beardhatcode.be> Signed-off-by: npmbuildbot-nextcloud[bot] <npmbuildbot-nextcloud[bot]@users.noreply.github.com>
The errors that required encodeURIComponent in the past have been mittigated by the following commit on nextcloud viewer. nextcloud/viewer@02e1b1a The code with hasScheme may be removed, viewer now returns a full properly encoded URI thanks to the work done in nextcloud-router fixes #381 Signed-off-by: Robbert Gurdeep Singh <git@beardhatcode.be> Signed-off-by: npmbuildbot-nextcloud[bot] <npmbuildbot-nextcloud[bot]@users.noreply.github.com>
I confirm I had the same issue after upgrading my instance to NC 21.0.2, now solved with your temporary fix replacing the file "apps/files_pdfviewer/js/files_pdfviewer-main.js" + restarting my browser. Many thanks for your temporary fix for that very critical issue ! Before that a new NC stable version including your fix is released, I suggest that Nextcloud removes 21.0.2 from the "stable" release channel, avoiding that other NC Users experience that critical bug. |
@RodSeq totally agree, some users might not be able to fix that easily because lack of experience. Some users may not be even able to access this file location cos of hosting limits. |
Please note that "stable" doesn't mean "bug free". Last but not least, "stable" also doesn't mean "apply it blindly". 😉 |
🩹 Temporary fix (will be shipped in the next Nextcloud minor release only)
ℹ️ This is a temporary fix you can apply manually, from PR #384. To do this:
1) Replace the file at
apps/files_pdfviewer/js/files_pdfviewer-main.js
on your instance with this file from that PR2) Clear your (each user must do it) browser's cache and try to open pdfs. This is a must-do, otherwise, the old file will be loaded from browser's cache !!
Steps to reproduce
Expected behaviour
Open the PDF with PDF viewer
Actual behaviour
PDF.js Version 2.5.207 (build: 0974d6052)
Nachricht: Missing PDF "https://domain.org/remote.php/dav/files/user/New/Juergen%2520Klopp.pdf".
Server configuration detail
Operating system: Linux 5.4.0-65-generic #73-Ubuntu SMP Mon Jan 18 17:25:17 UTC 2021 x86_64
Webserver: Apache/2.4.41 (Ubuntu) (apache2handler)
Database: mysql 8.0.25
PHP version:
8.0.5
Modules loaded: Core, date, libxml, openssl, pcre, zlib, filter, hash, json, Reflection, SPL, session, standard, sodium, apache2handler, mysqlnd, PDO, xml, apcu, bcmath, calendar, ctype, curl, dom, mbstring, FFI, fileinfo, ftp, gd, gettext, gmp, iconv, igbinary, imagick, intl, ldap, exif, mysqli, pdo_mysql, Phar, posix, readline, redis, shmop, SimpleXML, sockets, sysvmsg, sysvsem, sysvshm, tokenizer, xmlreader, xmlwriter, xsl, zip, Zend OPcache
Nextcloud version: 21.0.2 RC1 - 21.0.2.0
Updated from an older Nextcloud/ownCloud or fresh install:
Where did you install Nextcloud from: unknown
Signing status
Array
(
)
List of activated apps
Configuration (config/config.php)
Are you using external storage, if yes which one: local/smb/sftp/...
Are you using encryption:
Are you using an external user-backend, if yes which one: LDAP/ActiveDirectory/Webdav/...
Client configuration
Browser: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.212 Safari/537.36
The text was updated successfully, but these errors were encountered: