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

[Bug]: Public share from external storage results in Nextcloud Office GUID error #3251

Closed
6 of 8 tasks
ga-it opened this issue Oct 12, 2023 · 2 comments · Fixed by #3278
Closed
6 of 8 tasks

[Bug]: Public share from external storage results in Nextcloud Office GUID error #3251

ga-it opened this issue Oct 12, 2023 · 2 comments · Fixed by #3278
Labels
0. Needs triage bug Something isn't working

Comments

@ga-it
Copy link

ga-it commented Oct 12, 2023

⚠️ This issue respects the following points: ⚠️

Bug description

When making a public share from external storage (either mounted from administrative tools or user), the share results in a Nextcloud Office error "Error: Exception: Call to a member function getUID() on null"

This appears to be related to these issues:

nextcloud/activity#436
nextcloud/server#19996

Steps to reproduce

  1. Mount external storage (I mounted webdav share)
  2. Create public share (I created via an email share - I tried with varying permissions - e.g. read-only, etc)
    3.Attempt to access link

Expected behavior

Public link on external storage should work as it does on Nextcloud folder.

Installation method

Community Docker image

Nextcloud Server version

27

Operating system

Debian/Ubuntu

PHP engine version

PHP 8.1

Web server

Apache (supported)

Database engine version

PostgreSQL

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

Fresh Nextcloud Server install

Are you using the Nextcloud Server Encryption module?

Encryption is Disabled

What user-backends are you using?

  • Default user-backend (database)
  • LDAP/ Active Directory
  • SSO - SAML
  • Other

Configuration report

{
    "system": {
        "one-click-instance": true,
        "one-click-instance.user-limit": 100,
        "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
            }
        ],
        "check_data_directory_permissions": false,
        "memcache.distributed": "\\OC\\Memcache\\Redis",
        "memcache.locking": "\\OC\\Memcache\\Redis",
        "redis": {
            "host": "***REMOVED SENSITIVE VALUE***",
            "password": "***REMOVED SENSITIVE VALUE***",
            "port": 6379
        },
        "overwritehost": "***REMOVED SENSITIVE VALUE***",
        "overwriteprotocol": "https",
        "passwordsalt": "***REMOVED SENSITIVE VALUE***",
        "secret": "***REMOVED SENSITIVE VALUE***",
        "trusted_domains": [
            "localhost",
            "nextcloud.globaladvisors.biz"
        ],
        "datadirectory": "***REMOVED SENSITIVE VALUE***",
        "dbtype": "pgsql",
        "version": "27.1.0.7",
        "overwrite.cli.url": "https:\/\/nextcloud.globaladvisors.biz\/",
        "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***",
        "maintenance": false,
        "loglevel": "2",
        "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",
            "7": "OC\\Preview\\Krita",
            "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",
        "one-click-instance.link": "https:\/\/nextcloud.com\/all-in-one\/",
        "upgrade.cli-upgrade-link": "https:\/\/github.com\/nextcloud\/all-in-one\/discussions\/2726",
        "updatedirectory": "\/nc-updater",
        "davstorage.request_timeout": 3600,
        "htaccess.RewriteBase": "\/",
        "dbpersistent": true,
        "files_external_allow_create_new_local": true,
        "trusted_proxies": "***REMOVED SENSITIVE VALUE***",
        "allow_local_remote_servers": true,
        "preview_imaginary_url": "http:\/\/nextcloud-aio-imaginary:9000",
        "mail_from_address": "***REMOVED SENSITIVE VALUE***",
        "mail_sendmailmode": "smtp",
        "mail_domain": "***REMOVED SENSITIVE VALUE***",
        "mail_smtphost": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpport": "25",
        "twofactor_enforced": "true",
        "twofactor_enforced_groups": [],
        "twofactor_enforced_excluded_groups": [],
        "ldapProviderFactory": "OCA\\User_LDAP\\LDAPProviderFactory",
        "app_install_overwrite": [
            "vdirsyncerui"
        ],
        "enable_file_metadata": false

List of activated Apps

Enabled:
  - activity: 2.19.0
  - admin_audit: 1.17.0
  - announcementcenter: 6.6.2
  - appointments: 1.15.3
  - approval: 1.1.0
  - assistant: 1.0.1
  - audioplayer: 3.4.0
  - bruteforcesettings: 2.7.0
  - calendar: 4.5.2
  - calendar_resource_management: 0.5.0
  - cfg_share_links: 4.2.0
  - circles: 27.0.1
  - cloud_federation_api: 1.10.0
  - comments: 1.17.0
  - contacts: 5.4.2
  - contactsinteraction: 1.8.0
  - dashboard: 7.7.0
  - dav: 1.27.0
  - deck: 1.11.0
  - diary: 0.0.10
  - duplicatefinder: 1.0.5
  - external: 5.2.1
  - federatedfilesharing: 1.17.0
  - federation: 1.17.0
  - files: 1.22.0
  - files_accesscontrol: 1.17.1
  - files_antivirus: 5.2.2
  - files_archive: 1.1.3
  - files_automatedtagging: 1.17.0
  - files_downloadlimit: 1.1.0
  - files_external: 1.19.0
  - files_fulltextsearch: 27.0.1
  - files_mindmap: 0.0.29
  - files_reminders: 1.0.0
  - files_retention: 1.16.0
  - files_rightclick: 1.6.0
  - files_sharing: 1.19.0
  - files_trashbin: 1.17.0
  - files_versions: 1.20.0
  - files_zip: 1.4.0
  - firstrunwizard: 2.16.0
  - fulltextsearch: 27.0.2
  - fulltextsearch_elasticsearch: 27.0.4
  - gptfreeprompt: 1.0.1
  - group_default_quota: 0.1.7
  - groupfolders: 15.3.1
  - guests: 2.5.0
  - impersonate: 1.14.0
  - integration_openai: 1.0.13
  - integration_openproject: 2.4.4
  - integration_zimbra: 1.0.6
  - jitsi: 0.18.0
  - keeporsweep: 0.3.0
  - ldap_write_support: 1.9.0
  - logreader: 2.12.0
  - lookup_server_connector: 1.15.0
  - mail: 3.4.2
  - maps: 1.1.1
  - news: 24.0.0
  - nextcloud-aio: 0.4.0
  - nextcloud_announcements: 1.16.0
  - notes: 4.8.1
  - notifications: 2.15.0
  - notify_push: 0.6.3
  - oauth2: 1.15.1
  - password_policy: 1.17.0
  - passwords: 2023.9.30
  - photos: 2.3.0
  - polls: 5.3.2
  - privacy: 1.11.0
  - provisioning_api: 1.17.0
  - quota_warning: 1.17.0
  - recommendations: 1.6.0
  - related_resources: 1.2.0
  - richdocuments: 8.2.0
  - riotchat: 0.16.3
  - secrets: 1.5.2
  - serverinfo: 1.17.0
  - settings: 1.9.0
  - sharebymail: 1.17.0
  - sharepoint: 1.15.0
  - spreed: 17.1.1
  - stt_whisper: 1.0.6
  - support: 1.10.0
  - survey_client: 1.15.0
  - systemtags: 1.17.0
  - tables: 0.6.0
  - tasks: 0.15.0
  - terms_of_service: 2.3.1
  - text: 3.8.0
  - theming: 2.2.0
  - twofactor_backupcodes: 1.16.0
  - twofactor_email: 2.7.3
  - twofactor_nextcloud_notification: 3.7.0
  - twofactor_totp: 9.0.0
  - user_ldap: 1.17.0
  - user_status: 1.7.0
  - user_usage_report: 1.11.0
  - vdirsyncerui: 0.0.8
  - video_converter: 1.0.6
  - viewer: 2.1.0
  - weather_status: 1.7.0
  - welcome: 1.0.10
  - workflow_kitinerary: 1.3.0
  - workflow_ocr: 1.27.5
  - workflowengine: 2.9.0
  - workspace: 3.0.3
Disabled:
  - encryption: 2.15.0
  - files_pdfviewer: 2.8.0 (installed 2.8.0)
  - integration_deepl: 1.1.0 (installed 1.1.0)
  - socialsharing_email: 2.6.0 (installed 2.6.0)
  - suspicious_login: 5.0.0
  - twofactor_admin: 4.3.0

Nextcloud Signing status

No errors have been found.

Nextcloud Logs

{"reqId":"n2LUX3osSXT8DoT587Ck","level":3,"time":"2023-10-12T18:10:59+00:00","remoteAddr":"192.168.0.62","user":"--","app":"index","method":"GET","url":"/index.php/apps/richdocuments/wopi/files/90961_oc7u3aa5k4ov?access_token=qTLaZ0jVGv4rWBuaNFnHpCMVIdUiTuc4&access_token_ttl=1697170254000&permission=edit","message":"Call to a member function getUID() on null in file '/var/www/html/custom_apps/richdocuments/lib/PermissionManager.php' line 162","userAgent":"COOLWSD HTTP Agent 23.05.3.1","version":"27.1.0.7","exception":{"Exception":"Exception","Message":"Call to a member function getUID() on null in file '/var/www/html/custom_apps/richdocuments/lib/PermissionManager.php' line 162","Code":0,"Trace":[{"file":"/var/www/html/lib/private/AppFramework/App.php","line":183,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[["OCA\\Richdocuments\\Controller\\WopiController"],"checkFileInfo"]},{"file":"/var/www/html/lib/private/Route/Router.php","line":315,"function":"main","class":"OC\\AppFramework\\App","type":"::","args":["OCA\\Richdocuments\\Controller\\WopiController","checkFileInfo",["OC\\AppFramework\\DependencyInjection\\DIContainer"],["90961_oc7u3aa5k4ov","richdocuments.wopi.checkFileInfo"]]},{"file":"/var/www/html/lib/base.php","line":1068,"function":"match","class":"OC\\Route\\Router","type":"->","args":["/apps/richdocuments/wopi/files/90961_oc7u3aa5k4ov"]},{"file":"/var/www/html/index.php","line":36,"function":"handleRequest","class":"OC","type":"::","args":[]}],"File":"/var/www/html/lib/private/AppFramework/Http/Dispatcher.php","Line":169,"Previous":{"Exception":"Error","Message":"Call to a member function getUID() on null","Code":0,"Trace":[{"file":"/var/www/html/custom_apps/richdocuments/lib/Controller/WopiController.php","line":246,"function":"shouldWatermark","class":"OCA\\Richdocuments\\PermissionManager","type":"->","args":[["OC\\Files\\Node\\File"],null,["OC\\Share20\\Share"]]},{"file":"/var/www/html/lib/private/AppFramework/Http/Dispatcher.php","line":230,"function":"checkFileInfo","class":"OCA\\Richdocuments\\Controller\\WopiController","type":"->","args":["90961","qTLaZ0jVGv4rWBuaNFnHpCMVIdUiTuc4"]},{"file":"/var/www/html/lib/private/AppFramework/Http/Dispatcher.php","line":137,"function":"executeController","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[["OCA\\Richdocuments\\Controller\\WopiController"],"checkFileInfo"]},{"file":"/var/www/html/lib/private/AppFramework/App.php","line":183,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[["OCA\\Richdocuments\\Controller\\WopiController"],"checkFileInfo"]},{"file":"/var/www/html/lib/private/Route/Router.php","line":315,"function":"main","class":"OC\\AppFramework\\App","type":"::","args":["OCA\\Richdocuments\\Controller\\WopiController","checkFileInfo",["OC\\AppFramework\\DependencyInjection\\DIContainer"],["90961_oc7u3aa5k4ov","richdocuments.wopi.checkFileInfo"]]},{"file":"/var/www/html/lib/base.php","line":1068,"function":"match","class":"OC\\Route\\Router","type":"->","args":["/apps/richdocuments/wopi/files/90961_oc7u3aa5k4ov"]},{"file":"/var/www/html/index.php","line":36,"function":"handleRequest","class":"OC","type":"::","args":[]}],"File":"/var/www/html/custom_apps/richdocuments/lib/PermissionManager.php","Line":162},"CustomMessage":"--"},"id":"652852099e518"}

Additional info

"Well, this is embarrassing, we cannot connect to your document,"

In developer console:

"Failed to load resource: the server responded with a status of 500 ()"
https://nextcloud/apps/files_sharing/publicpreview/9ozfKfrfw2BLQsSpJg?x=1918&y=1643&a=true&file=aaa.pdf&scalingup=0

@ga-it ga-it added 0. Needs triage bug Something isn't working labels Oct 12, 2023
@joshtrichards joshtrichards transferred this issue from nextcloud/server Oct 22, 2023
@joshtrichards
Copy link
Member

Looks like in richdocuments this only gets triggered if "Show watermark for all shares is on:

if ($this->config->getAppValue(AppConfig::WATERMARK_APP_NAMESPACE, 'watermark_shareAll', 'no') === 'yes') {
if ($node->getOwner()->getUID() !== $userId) {

Looks like this bug was probably introduced in #2579 (possibly because this code path wasn't executed if the shares were public before).

Related (not the same but probably something that can be fixed at the same time): #1698

@juliusknorr
Copy link
Member

Thanks for digging that code part out. Pushed a fix in #3278

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0. Needs triage bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants