nextcloud / server

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

[Bug]: Preview image link doesn't work for users it was shared with #37186

Open sHHHk opened 1 year ago

sHHHk commented 1 year ago

⚠️ This issue respects the following points: ⚠️

Bug description

Whenever I share a picture with another user via Nextcloud Talk for example, the user with whom the picture was shared cannot see it under their preview URL.

In my example the user who uploaded the image can view it with both of these URLs. Whereas the user who the file was shared with can only view it in his Nextcloud Talk Folder under the second URL. The server throws a 404 for the first URL.

  1. Example for a preview URL: https://example.com/core/preview?fileId=1240931

  2. Example for https://example.com/remote.php/dav/files/user/Talk/20210908_091635.jpg

Steps to reproduce

Unfortunately I was not able to enclose the cause of this. I thought I could pin the issue down by disabling all apps with occ and disabling server sided encryption (which was originally enabled on my instance).

Expected behavior

I would assume that an image preview should be shown for the user who the file was shared with under the exact same link with the preview id.

In my example: https://example.com/core/preview?fileId=1240931

Installation method

Official All-in-One appliance

Operating system

Debian/Ubuntu

PHP engine version

PHP 8.0

Web server

Apache (supported)

Database engine version

PostgreSQL

Is this bug present after an update or on a fresh install?

None

Are you using the Nextcloud Server Encryption module?

Encryption is Disabled

What user-backends are you using?

Configuration report

{
    "system": {
        "memcache.local": "\\OC\\Memcache\\APCu",
        "apps_paths": [
            {
                "path": "\/var\/www\/html\/apps",
                "url": "\/apps",
                "writable": false
            },
            {
                "path": "\/var\/www\/html\/custom_apps",
                "url": "\/custom_apps",
                "writable": true
            }
        ],
        "memcache.distributed": "\\OC\\Memcache\\Redis",
        "memcache.locking": "\\OC\\Memcache\\Redis",
        "redis": {
            "host": "***REMOVED SENSITIVE VALUE***",
            "password": "***REMOVED SENSITIVE VALUE***",
            "port": 6379
        },
        "overwritehost": "example.com",
        "overwriteprotocol": "https",
        "passwordsalt": "***REMOVED SENSITIVE VALUE***",
        "secret": "***REMOVED SENSITIVE VALUE***",
        "trusted_domains": [
            "localhost",
            "example.com"
        ],
        "datadirectory": "***REMOVED SENSITIVE VALUE***",
        "dbtype": "pgsql",
        "version": "25.0.4.1",
        "overwrite.cli.url": "https:\/\/example.com\/",
        "dbname": "***REMOVED SENSITIVE VALUE***",
        "dbhost": "***REMOVED SENSITIVE VALUE***",
        "dbport": "",
        "dbtableprefix": "oc_",
        "dbuser": "***REMOVED SENSITIVE VALUE***",
        "dbpassword": "***REMOVED SENSITIVE VALUE***",
        "installed": true,
        "instanceid": "***REMOVED SENSITIVE VALUE***",
        "loglevel": "1",
        "log_type": "file",
        "logfile": "\/var\/www\/html\/data\/nextcloud.log",
        "log_rotate_size": "10485760",
        "log.condition": {
            "apps": [
                "admin_audit"
            ]
        },
        "preview_max_x": "2048",
        "preview_max_y": "2048",
        "jpeg_quality": "60",
        "enabledPreviewProviders": {
            "1": "OC\\Preview\\Image",
            "2": "OC\\Preview\\MarkDown",
            "3": "OC\\Preview\\MP3",
            "4": "OC\\Preview\\TXT",
            "5": "OC\\Preview\\OpenDocument",
            "6": "OC\\Preview\\Movie",
            "0": "OC\\Preview\\Imaginary"
        },
        "enable_previews": true,
        "upgrade.disable-web": true,
        "mail_smtpmode": "smtp",
        "trashbin_retention_obligation": "auto, 30",
        "versions_retention_obligation": "auto, 30",
        "activity_expire_days": "30",
        "simpleSignUpLink.shown": false,
        "share_folder": "\/Shared",
        "tempdirectory": "\/mnt\/ncdata\/tmp\/",
        "one-click-instance": true,
        "one-click-instance.user-limit": 100,
        "one-click-instance.link": "https:\/\/nextcloud.com\/all-in-one\/",
        "htaccess.RewriteBase": "\/",
        "files_external_allow_create_new_local": false,
        "trusted_proxies": "***REMOVED SENSITIVE VALUE***",
        "allow_local_remote_servers": true,
        "default_phone_region": "DE",
        "mail_smtpsecure": "ssl",
        "mail_sendmailmode": "smtp",
        "mail_from_address": "***REMOVED SENSITIVE VALUE***",
        "mail_domain": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpauthtype": "LOGIN",
        "mail_smtpauth": 1,
        "mail_smtpport": "465",
        "mail_smtphost": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpname": "***REMOVED SENSITIVE VALUE***",
        "mail_smtppassword": "***REMOVED SENSITIVE VALUE***",
        "twofactor_enforced": "false",
        "twofactor_enforced_groups": [],
        "twofactor_enforced_excluded_groups": [],
        "maintenance": false,
        "preview_imaginary_url": "http:\/\/nextcloud-aio-imaginary:9000",
        "app_install_overwrite": [
            "occweb",
            "whiteboard"
        ],
        "ldapProviderFactory": "OCA\\User_LDAP\\LDAPProviderFactory"
    }
}

List of activated Apps

Enabled:
  - activity: 2.17.0
  - admin_audit: 1.15.0
  - announcementcenter: 6.5.1
  - appointments: 1.14.11
  - approval: 1.0.12
  - bruteforcesettings: 2.5.0
  - calendar: 4.2.4
  - calendar_resource_management: 0.4.0
  - circles: 25.0.0
  - cloud_federation_api: 1.8.0
  - comments: 1.15.0
  - contacts: 5.1.0
  - contactsinteraction: 1.6.0
  - dashboard: 7.5.0
  - data_request: 1.12.0
  - dav: 1.24.0
  - deck: 1.8.3
  - drawio: 2.1.0
  - electronicsignatures: 2.0.3
  - encryption: 2.13.0
  - event_update_notification: 2.0.0
  - federatedfilesharing: 1.15.0
  - federation: 1.15.0
  - files: 1.20.1
  - files_automatedtagging: 1.15.2
  - files_downloadactivity: 1.15.0
  - files_downloadlimit: 1.0.1
  - files_external: 1.17.0
  - files_fulltextsearch: 25.0.0
  - files_linkeditor: 1.1.13
  - files_lock: 26.0.0
  - files_mindmap: 0.0.27
  - files_pdfviewer: 2.6.0
  - files_retention: 1.14.1
  - files_rightclick: 1.4.0
  - files_sharing: 1.17.0
  - files_trashbin: 1.15.0
  - files_versions: 1.18.0
  - firstrunwizard: 2.14.0
  - forms: 3.2.0
  - fulltextsearch: 25.0.0
  - fulltextsearch_elasticsearch: 25.0.0
  - group_everyone: 0.1.12
  - groupfolders: 13.1.1
  - login_notes: 1.1.0
  - logreader: 2.10.0
  - lookup_server_connector: 1.13.0
  - mail: 2.2.4
  - maps: 0.2.4
  - nextcloud-aio: 0.3.0
  - nextcloud_announcements: 1.14.0
  - notes: 4.6.0
  - notifications: 2.13.1
  - notify_push: 0.6.0
  - oauth2: 1.13.0
  - occweb: 0.1.0
  - password_policy: 1.15.0
  - passwords: 2023.3.10
  - photos: 2.0.1
  - polls: 4.1.8
  - previewgenerator: 5.2.1
  - privacy: 1.9.0
  - provisioning_api: 1.15.0
  - quota_warning: 1.15.0
  - recognize: 3.6.2
  - recommendations: 1.4.0
  - registration: 2.1.0
  - related_resources: 1.0.4
  - richdocuments: 7.1.1
  - serverinfo: 1.15.0
  - settings: 1.7.0
  - sharebymail: 1.15.0
  - sociallogin: 5.4.1
  - spreed: 15.0.4
  - support: 1.8.0
  - survey_client: 1.13.0
  - suspicious_login: 4.3.0
  - systemtags: 1.15.0
  - talked: 0.5.0
  - tasks: 0.14.5
  - terms_of_service: 2.1.0
  - text: 3.6.0
  - theming: 2.0.1
  - timemanager: 0.3.6
  - twofactor_backupcodes: 1.14.0
  - twofactor_email: 2.7.2
  - twofactor_gateway: 0.20.0
  - twofactor_nextcloud_notification: 3.6.0
  - twofactor_reminder: 1.0.0
  - twofactor_totp: 7.0.0
  - twofactor_webauthn: 1.1.2
  - unroundedcorners: 1.0.8
  - user_ldap: 1.15.0
  - user_saml: 5.1.2
  - user_status: 1.5.0
  - viewer: 1.9.0
  - weather_status: 1.5.0
  - welcome: 1.0.8
  - workflowengine: 2.7.0
Disabled:
  - files_accesscontrol: 1.15.1

Nextcloud Signing status

No errors have been found.

Nextcloud Logs

{
  "reqId": "A5jH1p68JHVxa3TrjQYn",
  "level": 0,
  "time": "2023-03-11T18:56:12+00:00",
  "remoteAddr": "188.192.16.245",
  "user": "admin",
  "app": "user_saml",
  "method": "GET",
  "url": "/core/preview?fileId=1240931&x=1920&y=1080&a=true",
  "message": "/appinfo/app.php is deprecated, use \\OCP\\AppFramework\\Bootstrap\\IBootstrap on the application class instead.",
  "userAgent": "Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/110.0",
  "version": "25.0.4.1",
  "data": {
    "app": "user_saml"
  }
}
{
  "reqId": "A5jH1p68JHVxa3TrjQYn",
  "level": 0,
  "time": "2023-03-11T18:56:12+00:00",
  "remoteAddr": "188.192.16.245",
  "user": "admin",
  "app": "encryption",
  "method": "GET",
  "url": "/core/preview?fileId=1240931&x=1920&y=1080&a=true",
  "message": "/appinfo/app.php is deprecated, use \\OCP\\AppFramework\\Bootstrap\\IBootstrap on the application class instead.",
  "userAgent": "Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/110.0",
  "version": "25.0.4.1",
  "data": {
    "app": "encryption"
  }
}
{
  "reqId": "A5jH1p68JHVxa3TrjQYn",
  "level": 0,
  "time": "2023-03-11T18:56:12+00:00",
  "remoteAddr": "188.192.16.245",
  "user": "admin",
  "app": "files_mindmap",
  "method": "GET",
  "url": "/core/preview?fileId=1240931&x=1920&y=1080&a=true",
  "message": "/appinfo/app.php is deprecated, use \\OCP\\AppFramework\\Bootstrap\\IBootstrap on the application class instead.",
  "userAgent": "Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/110.0",
  "version": "25.0.4.1",
  "data": {
    "app": "files_mindmap"
  }
}
{
  "reqId": "A5jH1p68JHVxa3TrjQYn",
  "level": 1,
  "time": "2023-03-11T18:56:12+00:00",
  "remoteAddr": "188.192.16.245",
  "user": "admin",
  "app": "no app in context",
  "method": "GET",
  "url": "/core/preview?fileId=1240931&x=1920&y=1080&a=true",
  "message": "Deprecated event type for OCP\\IPreview:PreviewRequested: Symfony\\Component\\EventDispatcher\\GenericEvent is used",
  "userAgent": "Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/110.0",
  "version": "25.0.4.1",
  "data": []
}

{
  "reqId": "jPDpyM8aB9D22gNeDjkd",
  "level": 0,
  "time": "2023-03-11T18:56:16+00:00",
  "remoteAddr": "188.192.16.245",
  "user": "admin",
  "app": "user_saml",
  "method": "GET",
  "url": "/core/preview?fileId=1240931&x=1920&y=1080&a=true",
  "message": "/appinfo/app.php is deprecated, use \\OCP\\AppFramework\\Bootstrap\\IBootstrap on the application class instead.",
  "userAgent": "Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/110.0",
  "version": "25.0.4.1",
  "data": {
    "app": "user_saml"
  }
}
{
  "reqId": "jPDpyM8aB9D22gNeDjkd",
  "level": 0,
  "time": "2023-03-11T18:56:16+00:00",
  "remoteAddr": "188.192.16.245",
  "user": "admin",
  "app": "encryption",
  "method": "GET",
  "url": "/core/preview?fileId=1240931&x=1920&y=1080&a=true",
  "message": "/appinfo/app.php is deprecated, use \\OCP\\AppFramework\\Bootstrap\\IBootstrap on the application class instead.",
  "userAgent": "Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/110.0",
  "version": "25.0.4.1",
  "data": {
    "app": "encryption"
  }
}
{
  "reqId": "jPDpyM8aB9D22gNeDjkd",
  "level": 0,
  "time": "2023-03-11T18:56:16+00:00",
  "remoteAddr": "188.192.16.245",
  "user": "admin",
  "app": "files_mindmap",
  "method": "GET",
  "url": "/core/preview?fileId=1240931&x=1920&y=1080&a=true",
  "message": "/appinfo/app.php is deprecated, use \\OCP\\AppFramework\\Bootstrap\\IBootstrap on the application class instead.",
  "userAgent": "Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/110.0",
  "version": "25.0.4.1",
  "data": {
    "app": "files_mindmap"
  }
}
{
  "reqId": "jPDpyM8aB9D22gNeDjkd",
  "level": 1,
  "time": "2023-03-11T18:56:16+00:00",
  "remoteAddr": "188.192.16.245",
  "user": "admin",
  "app": "no app in context",
  "method": "GET",
  "url": "/core/preview?fileId=1240931&x=1920&y=1080&a=true",
  "message": "Deprecated event type for OCP\\IPreview:PreviewRequested: Symfony\\Component\\EventDispatcher\\GenericEvent is used",
  "userAgent": "Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/110.0",
  "version": "25.0.4.1",
  "data": []
}

Additional info

No response

EricThi commented 1 year ago

Same idea of : https://github.com/nextcloud/server/issues/36013 ?

mejo- commented 5 months ago

@sHHHk sorry for the late reponse. Could you elaborate on how to reproduce the issue? Or what you mean with "preview image link doesn't work"? Do you mean that a file shared with another user doesn't display the preview in their file list?

Please provide a screenshot of what you consider broken.

EricThi commented 5 months ago

@sHHHk You describe error with talk app. (on my side, same issue, via web ou mobile app(android and ios)) => if you click on picture ; you can see it

Have you tested on files app ? (web and mobile ?) thumbnail are not created and on : web : you can see picture mobile : get error "No resized image available. Download full image?" => if Yes, picture(or video) is downloaded and can be watch locally.

Example : If folder his not shared : Screenshot 2024-06-20 at 09-06-35 Files - Nextcloud

If folder his shared by other(here user S) : Screenshot 2024-06-20 at 08-58-15 Files - Nextcloud

=> via web app, click on file and you see it => via app : you can see it

If share via link : no preview too I have configure preview, generate all, systemd generate all preview for all new files : no change

nextcloud-command commented 4 months ago

This issue has been automatically marked as stale because it has not had recent activity and seems to be missing some essential information. It will be closed if no further activity occurs. Thank you for your contributions.

joshtrichards commented 1 month ago

As @mejo- stated: please elaborate on how to reproduce this. Please be as step-by-step as possible. If we cannot reproduce, it'll be very challenging to sort out what is going on.

How are you creating the initial share?

Are you opening the file details/sharing tab and selecting Share link to generate a shareable link?

Or are you using the Talk paperclip then selecting Share from Nextcloud?

It sounds more like you're trying to use an Internal link to share with someone, but they don't actually have access to the share. So this would be expected behavior.

In my example the user who uploaded the image can view it with both of these URLs. Whereas the user who the file was shared with can only view it in his Nextcloud Talk Folder under the second URL. The server throws a 404 for the first URL.

Example for a preview URL: https://example.com/core/preview?fileId=1240931

This would be an Internal Link (well it's what it gets transformed to after the shorter one is generated). It won't work unless the destination party already has share access to this file (i.e. you've shared the folder or file previously with them with appropriate rights).

Example for https://example.com/remote.php/dav/files/user/Talk/20210908_091635.jpg

This second was likely shared using the Talk paperclip then selecting Share from Nextcloud. Because shareable links don't generate files here since they're not attachments.

nextcloud-command commented 1 week ago

This issue has been automatically marked as stale because it has not had recent activity and seems to be missing some essential information. It will be closed if no further activity occurs. Thank you for your contributions.