Server: Error loading big preview of images in publicly shared links with special chars in folder names

Created on 17 Sep 2020  ·  3Comments  ·  Source: nextcloud/server

How to use GitHub

  • Please use the 👍 reaction to show that you are affected by the same issue.
  • Please don't comment if you have no relevant information to add. It's just extra noise for everyone subscribed to this issue.
  • Subscribe to receive notifications on status change and new comments.

Steps to reproduce

  1. Share a folder with images via link
  2. Visit the shared link
  3. Click on an image to view it bigger

Expected behaviour

The image should load in the modal.

Actual behaviour

The modal is opened, but the image is not and the error Error loading IMG_20200942_175555.jpg is shown.
image

Server configuration

Operating system: Ubuntu 20.04 - Linux 5.4.0-42-generic x86_64

Web server: Apache

Database: Mysql 10.1.44

PHP version: 7.4.3

Nextcloud version: 19.0.3

Updated from an older Nextcloud/ownCloud or fresh install: Updated every release (major or minor) since Nextcloud 17

Where did you install Nextcloud from: git

Signing status:


Signing status

No errors have been found.

List of activated apps:


App list

Enabled:
  - accessibility: 1.5.0
  - activity: 2.12.0
  - apporder: 0.11.0
  - bruteforcesettings: 2.0.1
  - calendar: 2.0.4
  - cloud_federation_api: 1.2.0
  - comments: 1.9.0
  - contacts: 3.3.0
  - contactsinteraction: 1.0.0
  - dav: 1.15.0
  - deck: 1.0.5
  - duplicatefinder: 0.0.2
  - federatedfilesharing: 1.9.0
  - federation: 1.9.0
  - files: 1.14.0
  - files_external: 1.10.0
  - files_markdown: 2.3.0
  - files_pdfviewer: 1.8.0
  - files_rightclick: 0.16.0
  - files_sharing: 1.11.0
  - files_trashbin: 1.9.0
  - files_versions: 1.12.0
  - files_videoplayer: 1.8.0
  - firstrunwizard: 2.8.0
  - logreader: 2.4.0
  - lookup_server_connector: 1.7.0
  - maps: 0.1.6
  - metadata: 0.12.0
  - news: 14.2.2
  - nextcloud_announcements: 1.8.0
  - notes: 3.6.4
  - notifications: 2.7.0
  - oauth2: 1.7.0
  - password_policy: 1.9.1
  - photos: 1.1.0
  - previewgenerator: 2.3.0
  - privacy: 1.3.0
  - provisioning_api: 1.9.0
  - richdocuments: 3.7.4
  - richdocumentscode: 4.2.800
  - serverinfo: 1.9.0
  - settings: 1.1.0
  - sharebymail: 1.9.0
  - social: 0.3.1
  - spreed: 9.0.3
  - support: 1.2.1
  - survey_client: 1.7.0
  - systemtags: 1.9.0
  - tasks: 0.13.3
  - text: 3.0.1
  - theming: 1.10.0
  - twofactor_backupcodes: 1.8.0
  - twofactor_totp: 5.0.0
  - twofactor_u2f: 6.0.0
  - updatenotification: 1.9.0
  - viewer: 1.3.0
  - workflowengine: 2.1.0
Disabled:
  - admin_audit
  - breezedark
  - carnet
  - dicomviewer
  - drawio
  - encryption
  - gpxmotion
  - gpxpod
  - recommendations
  - user_ldap

Nextcloud configuration:


Config report

{
    "system": {
        "instanceid": "***REMOVED SENSITIVE VALUE***",
        "passwordsalt": "***REMOVED SENSITIVE VALUE***",
        "secret": "***REMOVED SENSITIVE VALUE***",
        "trusted_domains": [
            "files.dorkfarm.com"
        ],
        "datadirectory": "***REMOVED SENSITIVE VALUE***",
        "overwrite.cli.url": "https:\/\/files.dorkfarm.com",
        "dbtype": "mysql",
        "version": "19.0.3.1",
        "dbname": "***REMOVED SENSITIVE VALUE***",
        "dbhost": "***REMOVED SENSITIVE VALUE***",
        "dbport": "3306",
        "dbtableprefix": "oc_",
        "dbuser": "***REMOVED SENSITIVE VALUE***",
        "dbpassword": "***REMOVED SENSITIVE VALUE***",
        "installed": true,
        "mysql.utf8mb4": true,
        "maintenance": false,
        "memcache.local": "\\OC\\Memcache\\Redis",
        "redis": {
            "host": "***REMOVED SENSITIVE VALUE***",
            "port": 6379
        },
        "filelocking.enabled": true,
        "memcache.locking": "\\OC\\Memcache\\Redis",
        "mail_from_address": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpmode": "smtp",
        "mail_smtpauthtype": "LOGIN",
        "mail_domain": "***REMOVED SENSITIVE VALUE***",
        "updater.release.channel": "stable",
        "theme": "",
        "loglevel": 0,
        "mail_smtpauth": 1,
        "mail_smtphost": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpport": "587",
        "mail_smtpname": "***REMOVED SENSITIVE VALUE***",
        "mail_smtppassword": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpsecure": "tls",
        "has_rebuilt_cache": true,
        "app_install_overwrite": [
            "admin_notifications"
        ],
        "debug": false,
        "remember_login_cookie_lifetime": 1296000,
        "session_lifetime": 86400,
        "session_keepalive": true,
        "preview_max_x": "2048",
        "preview_max_y": "2048",
        "jpeg_quality": "75",
        "mail_sendmailmode": "smtp"
    }
}

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

Are you using encryption: no

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

Client configuration

Browser: Firefox, Chrome

Operating system: Ubuntu

Logs

Browser log


Browser log

GET https://domain.something/index.php/apps/files_sharing/publicpreview/2ZCNKYib8nNtopp?fileId=1377313&file=/somepatchwotj&in_it/IMG_20200903_144377.jpg&x=3072&y=1728&a=true
[HTTP/1.1 404 Not Found 95ms]

GET https://domain.something/index.php/apps/files_sharing/publicpreview/2ZCNKYib8nNtopp?fileId=1477192&file=/somepatchwotj&in_it/IMG_20200903_151877.jpg&x=3072&y=1728&a=true
[HTTP/1.1 404 Not Found 110ms]

GET https://domain.something/index.php/apps/files_sharing/publicpreview/2ZCNKYib8nNtopp?fileId=1577171&file=/somepatchwotj&in_it/IMG_20200903_151977.jpg&x=3072&y=1728&a=true
[HTTP/1.1 404 Not Found 205ms]

Error loading /somepatchwotj&in_it/IMG_20200903_144377.jpg 
error { target: img.hidden-visually.file-view, isTrusted: true, srcElement: img.hidden-visually.file-view, currentTarget: img.hidden-visually.file-view
, eventPhase: 2, bubbles: false, cancelable: false, returnValue: true, defaultPrevented: false, composed: false, … }
Mime.js:127:11
Error loading /somepatchwotj&in_it/IMG_20200903_151877.jpg 
error { target: img.file-view.active, isTrusted: true, srcElement: img.file-view.active, currentTarget: img.file-view.active
, eventPhase: 2, bubbles: false, cancelable: false, returnValue: true, defaultPrevented: false, composed: false, … }
Mime.js:127:11
Error loading /Petre&Alecs/IMG_20200903_151977.jpg 
error { target: img.hidden-visually.file-view, isTrusted: true, srcElement: img.hidden-visually.file-view, currentTarget: img.hidden-visually.file-view
, eventPhase: 2, bubbles: false, cancelable: false, returnValue: true, defaultPrevented: false, composed: false, … }
Mime.js:127:11

Looks like the issue is caused by an unencoded URL param (& char in the path of the file). Images in a different path, without &, work without issues.
Also, the small preview always works because the file param in the URL is encoded, but for the bigger preview it is not:

Works: https://very-cool-domain-name.com/index.php/apps/files_sharing/publicpreview/2ZCNKYib8nNtopp?fileId=2345&file=%2Fme%26them%2FIMG_20200942_140532.jpg&c=7baa22c053a7e28b43cf025c87b0c784&x=313&y=313

Does not work: https://very-cool-domain-name.com/index.php/apps/files_sharing/publicpreview/2ZCNKYib8nNtopp?fileId=2&file=/me&them/IMG_20200942_140532.jpg&x=3072&y=1728&a=true

1. to develop bug

Most helpful comment

Just to add: A file with & does not work either. If one want's to reproduce the folder case make sure to share a folder with a folder inside. Example: Photos -> 2020 March & April. Create a share link for Photos. A share link for 2020 March & April would work.

All 3 comments

Just to add: A file with & does not work either. If one want's to reproduce the folder case make sure to share a folder with a folder inside. Example: Photos -> 2020 March & April. Create a share link for Photos. A share link for 2020 March & April would work.

Same/similar here, in my case it's a + in the file name. With +, I get the same error, without the error is gone.

Was this page helpful?
0 / 5 - 0 ratings