nextcloud / server

☁️ Nextcloud server, a safe home for all your data
https://nextcloud.com
GNU Affero General Public License v3.0
27.46k stars 4.08k forks source link

PDF.js cannot open file with space (%20) in URL #27116

Closed s4g1n0 closed 3 years ago

s4g1n0 commented 3 years ago

This looks like some error in escaping of URL containing "%20", as this is escaped into "%2520" and then file is not found. Original directory URL: https://example.com/index.php/apps/files/?dir=/abcd/test/Documents/Testing%20Directory&fileid=1852584 Broken PDF file url: https://example.com/remote.php/dav/files/abcd/test/Documents/Testing%2520Directory/202105.pdf

Steps to reproduce

  1. Open whatever directory with space in name
  2. Try to open pdf in that directory

Expected behaviour

PDF will be loaded inside PDF.js in browser

Actual behaviour

PDF.js loads with error message: PDF.js v2.5.207 (build: 0974d6052) Message: Missing PDF "https://example.com/remote.php/dav/files/abcd/test/Documents/Testing%2520Directory/202105.pdf".

Server configuration

Operating system: Debian stable 10.9

Web server: apache2 2.4.38-3+deb10u4

Database: mariadb-server 1:10.3.27-0+deb10u1

PHP version: libapache2-mod-php 2:7.3+69

Nextcloud version: 21.0.2

Updated from an older Nextcloud/ownCloud or fresh install: updated from previous version

Where did you install Nextcloud from:

Signing status:

Signing status No errors have been found.

List of activated apps:

App list Enabled: - accessibility: 1.7.0 - activity: 2.14.3 - audioplayer: 3.1.0 - bruteforcesettings: 2.1.0 - calendar: 2.2.1 - cloud_federation_api: 1.4.0 - comments: 1.11.0 - contacts: 3.5.1 - contactsinteraction: 1.2.0 - dav: 1.17.1 - external: 3.8.1 - federatedfilesharing: 1.11.0 - federation: 1.11.0 - files: 1.16.0 - files_external: 1.12.0 - files_pdfviewer: 2.1.0 - files_rightclick: 1.0.0 - files_sharing: 1.13.1 - files_trashbin: 1.11.0 - files_versions: 1.14.0 - files_videoplayer: 1.10.0 - firstrunwizard: 2.10.0 - keeweb: 0.6.5 - logreader: 2.6.0 - lookup_server_connector: 1.9.0 - nextcloud_announcements: 1.10.0 - notifications: 2.9.0 - oauth2: 1.9.0 - occweb: 0.0.7 - password_policy: 1.11.0 - photos: 1.3.0 - privacy: 1.5.0 - provisioning_api: 1.11.0 - ransomware_protection: 1.10.1 - recommendations: 1.0.0 - richdocuments: 4.1.1 - richdocumentscode: 6.4.806 - serverinfo: 1.11.0 - settings: 1.3.0 - sharebymail: 1.11.0 - spreed: 11.2.1 - support: 1.4.0 - survey_client: 1.9.0 - systemtags: 1.11.0 - text: 3.2.0 - theming: 1.12.0 - twofactor_backupcodes: 1.10.0 - updatenotification: 1.11.0 - user_ldap: 1.11.0 - user_status: 1.1.1 - viewer: 1.5.0 - weather_status: 1.1.0 - workflowengine: 2.3.0Disabled: - admin_audit - dashboard - encryption

Nextcloud configuration:

Config report { "system": { "instanceid": "***REMOVED SENSITIVE VALUE***", "passwordsalt": "***REMOVED SENSITIVE VALUE***", "secret": "***REMOVED SENSITIVE VALUE***", "trusted_domains": [ "example.com" ], "datadirectory": "***REMOVED SENSITIVE VALUE***", "dbtype": "mysql", "version": "21.0.2.1", "overwrite.cli.url": "https:\/\/emaple.com", "dbname": "***REMOVED SENSITIVE VALUE***", "dbhost": "***REMOVED SENSITIVE VALUE***", "dbport": "", "dbtableprefix": "oc_", "mysql.utf8mb4": true, "dbuser": "***REMOVED SENSITIVE VALUE***", "dbpassword": "***REMOVED SENSITIVE VALUE***", "installed": true, "filelocking.enabled": true, "memcache.locking": "\\OC\\Memcache\\Redis", "memcache.local": "\\OC\\Memcache\\APCu", "memcache.distributed": "\\OC\\Memcache\\Redis", "redis": { "host": "***REMOVED SENSITIVE VALUE***", "port": 0, "dbindex": 0, "password": "***REMOVED SENSITIVE VALUE***", "timeout": 1.5 }, "mail_from_address": "***REMOVED SENSITIVE VALUE***", "mail_smtpmode": "smtp", "mail_sendmailmode": "smtp", "mail_domain": "***REMOVED SENSITIVE VALUE***", "mail_smtpsecure": "tls", "mail_smtphost": "***REMOVED SENSITIVE VALUE***", "mail_smtpport": "25", "maintenance": false, "theme": "", "loglevel": 2, "app_install_overwrite": [ "occweb" ], "ldapIgnoreNamingRules": false, "ldapProviderFactory": "OCA\\User_LDAP\\LDAPProviderFactory", "default_phone_region": "SK" }}

Are you using external storage, if yes which one: smb

Are you using encryption: no

Are you using an external user-backend, if yes which one: LDAP

LDAP configuration (delete this part if not used)

LDAP config ``` With access to your command line run e.g.: sudo -u www-data php occ ldap:show-config from within your Nextcloud installation folder Without access to your command line download the data/owncloud.db to your local computer or access your SQL server remotely and run the select query: SELECT * FROM `oc_appconfig` WHERE `appid` = 'user_ldap'; Eventually replace sensitive data as the name/IP-address of your LDAP server or groups. ```

Client configuration

Browser: Opera, Firefox

Operating system: Windows 10, Debian testing

Logs

Web server error log

Web server error log ``` Insert your webserver log here ```

Nextcloud log (data/nextcloud.log)

Nextcloud log ``` Insert your Nextcloud log here ```

Browser log

Browser log ``` Insert your browser log here, this could for example include: a) The javascript console log b) The network log c) ... ```
kesselb commented 3 years ago

https://github.com/nextcloud/files_pdfviewer/issues/381