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]: Sharing links with null labels broken after upgrade to NC-30 #48629

Closed
6 of 8 tasks
umlaeute opened this issue Oct 9, 2024 · 11 comments · Fixed by #48673
Closed
6 of 8 tasks

[Bug]: Sharing links with null labels broken after upgrade to NC-30 #48629

umlaeute opened this issue Oct 9, 2024 · 11 comments · Fixed by #48673
Labels
0. Needs triage Pending check for reproducibility or if it fits our roadmap 30-feedback bug feature: sharing

Comments

@umlaeute
Copy link

umlaeute commented Oct 9, 2024

⚠️ This issue respects the following points: ⚠️

Bug description

I'm running a Nextcloud instance on Debian/bookworm

Last week, I upgraded the old NC-29.0.3.4 instance to (first) 29.0.7.1 and once that looked good enough, continued to upgrade to 30.0.0.14.

Now one of users reported, that one of their public sharing links no longer works - a link that used to work (according to them) for the last years without any issues whatsoever.
I can confirm their observation that whenever somebody visits the public sharing link, they get an "Internal Server Error":
Internal Server Error

The file in question is an mp4 video file.

Steps to reproduce

  1. Have an old public sharing link
  2. Upgrade to NC-30
  3. Access the public sharing link

I'm aware that there is more to it. I know of other public sharing links that continue to work.

Expected behavior

I expect that sharing links continue to work across upgrades.
More-over I expect that no "Internal Server Error" is thrown.

Nextcloud Server version

30

Operating system

Debian/Ubuntu

PHP engine version

PHP 8.2

Web server

Apache (supported)

Database engine version

PostgreSQL

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

Upgraded to a MAJOR version (ex. 28 to 29)

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": {
        "instanceid": "***REMOVED SENSITIVE VALUE***",
        "version": "30.0.0.14",
        "installed": true,
        "maintenance": false,
        "maintenance_window_start": 3,
        "singleuser": false,
        "updatechecker": false,
        "name": "iemCloud",
        "title": "iemCloud",
        "theme": "",
        "trusted_domains": [
            "cloud.iem.at",
            "cloud.iemnet"
        ],
        "log_type": "file",
        "logfile": "\/var\/log\/owncloud\/owncloud.log",
        "loglevel": 2,
        "datadirectory": "***REMOVED SENSITIVE VALUE***",
        "trashbin_retention_obligation": "auto",
        "passwordsalt": "***REMOVED SENSITIVE VALUE***",
        "secret": "***REMOVED SENSITIVE VALUE***",
        "dbtype": "pgsql",
        "dbhost": "***REMOVED SENSITIVE VALUE***",
        "dbname": "***REMOVED SENSITIVE VALUE***",
        "dbuser": "***REMOVED SENSITIVE VALUE***",
        "dbpassword": "***REMOVED SENSITIVE VALUE***",
        "dbtableprefix": "oc_",
        "lost_password_link": "https:\/\/users.iem.at\/login",
        "mail_domain": "***REMOVED SENSITIVE VALUE***",
        "mail_from_address": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpdebug": false,
        "mail_smtpmode": "smtp",
        "mail_smtphost": "***REMOVED SENSITIVE VALUE***",
        "defaultapp": "files,dashboard",
        "appstoreenabled": true,
        "appstore.experimental.enabled": false,
        "appstoreurl": "https:\/\/apps.nextcloud.com\/api\/v1",
        "apps_paths": [
            {
                "path": "\/var\/www\/nextcloud\/apps",
                "url": "\/apps",
                "writable": true
            }
        ],
        "enable_previews": true,
        "preview_libreoffice_path": "\/usr\/bin\/libreoffice",
        "preview_office_cl_parameters": " --headless --nologo --nofirststartwizard --invisible --norestore -convert-to pdf -outdir ",
        "default_phone_region": "AT",
        "ldapIgnoreNamingRules": false,
        "forcessl": true,
        "log_rotate_size": 10485760,
        "ldapProviderFactory": "\\OCA\\User_LDAP\\LDAPProviderFactory",
        "overwrite.cli.url": "https:\/\/cloud.iem.at",
        "memcache.local": "\\OC\\Memcache\\Redis",
        "memcache.locking": "\\OC\\Memcache\\Redis",
        "filelocking.enabled": "true",
        "redis": {
            "host": "***REMOVED SENSITIVE VALUE***",
            "port": 0,
            "timeout": 0
        },
        "memcache.distributed": "\\OC\\Memcache\\Memcached",
        "memcached_servers": [
            [
                "localhost",
                11211
            ]
        ],
        "mail_sendmailmode": "smtp",
        "mail_smtpauth": 1,
        "mail_smtpport": "587",
        "mail_smtpname": "***REMOVED SENSITIVE VALUE***",
        "mail_smtppassword": "***REMOVED SENSITIVE VALUE***"
    }
}

List of activated Apps

Enabled:

  • activity: 3.0.0
  • admin_audit: 1.20.0
  • bruteforcesettings: 3.0.0
  • calendar: 5.0.0
  • circles: 30.0.0-dev
  • cloud_federation_api: 1.13.0
  • comments: 1.20.1
  • contacts: 6.1.0
  • contactsinteraction: 1.11.0
  • dashboard: 7.10.0
  • dav: 1.31.1
  • federatedfilesharing: 1.20.0
  • federation: 1.20.0
  • files: 2.2.0
  • files_downloadlimit: 3.0.0
  • files_pdfviewer: 3.0.0
  • files_reminders: 1.3.0
  • files_sharing: 1.22.0
  • files_trashbin: 1.20.1
  • files_versions: 1.23.0
  • firstrunwizard: 3.0.0
  • forms: 4.3.1
  • logreader: 3.0.0
  • lookup_server_connector: 1.18.0
  • nextcloud_announcements: 2.0.0
  • notifications: 3.0.0
  • oauth2: 1.18.1
  • password_policy: 2.0.0
  • photos: 3.0.2
  • privacy: 2.0.0
  • provisioning_api: 1.20.0
  • recommendations: 3.0.0
  • related_resources: 1.5.0
  • richdocuments: 8.5.1
  • serverinfo: 2.0.0
  • settings: 1.13.0
  • sharebymail: 1.20.0
  • support: 2.0.0
  • survey_client: 2.0.0
  • systemtags: 1.20.0
  • text: 4.1.0
  • theming: 2.5.0
  • twofactor_backupcodes: 1.19.0
  • updatenotification: 1.20.0
  • user_ldap: 1.21.0
  • user_status: 1.10.0
  • viewer: 3.0.0
  • weather_status: 1.10.0
  • webhook_listeners: 1.1.0-dev
  • workflowengine: 2.12.0

Disabled:

  • encryption: 2.18.0
  • files_external: 1.22.0 (installed 0.2)
  • files_rightclick: 0.15.1 (installed 1.6.0)
  • inventory: 0.1.2 (installed 0.1.2)
  • suspicious_login: 8.0.0
  • tasks: 0.16.1 (installed 0.16.1)
  • twofactor_nextcloud_notification: 4.0.0
  • twofactor_totp: 12.0.0-dev

Nextcloud Signing status

No errors have been found.

Nextcloud Logs

(note that the remoteAddr has been obfuscated)

{
  "reqId": "VUrnQNQHDu5lb2E9ykT0",
  "level": 3,
  "time": "2024-10-09T10:54:53+00:00",
  "remoteAddr": "1.2.3.4",
  "user": "--",
  "app": "index",
  "method": "GET",
  "url": "/index.php/s/BnewRUlh9iPY5sR",
  "message": "OCP\\AppFramework\\Http\\Template\\PublicTemplateResponse::setHeaderTitle(): Argument #1 ($title) must be of type string, null given, called in /var/www/nextcloud/apps/files_sharing/lib/DefaultPublicShareTemplateProvider.php on line 235 in file '/var/www/nextcloud/lib/public/AppFramework/Http/Template/PublicTemplateResponse.php' line 45",
  "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.0.1 Safari/605.1.15",
  "version": "30.0.0.14",
  "exception": {
    "Exception": "Exception",
    "Message": "OCP\\AppFramework\\Http\\Template\\PublicTemplateResponse::setHeaderTitle(): Argument #1 ($title) must be of type string, null given, called in /var/www/nextcloud/apps/files_sharing/lib/DefaultPublicShareTemplateProvider.php on line 235 in file '/var/www/nextcloud/lib/public/AppFramework/Http/Template/PublicTemplateResponse.php' line 45",
    "Code": 0,
    "Trace": [
      {
        "file": "/var/www/nextcloud/lib/private/AppFramework/App.php",
        "line": 161,
        "function": "dispatch",
        "class": "OC\\AppFramework\\Http\\Dispatcher",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/lib/private/Route/Router.php",
        "line": 302,
        "function": "main",
        "class": "OC\\AppFramework\\App",
        "type": "::"
      },
      {
        "file": "/var/www/nextcloud/lib/base.php",
        "line": 1001,
        "function": "match",
        "class": "OC\\Route\\Router",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/index.php",
        "line": 24,
        "function": "handleRequest",
        "class": "OC",
        "type": "::"
      }
    ],
    "File": "/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php",
    "Line": 146,
    "Previous": {
      "Exception": "TypeError",
      "Message": "OCP\\AppFramework\\Http\\Template\\PublicTemplateResponse::setHeaderTitle(): Argument #1 ($title) must be of type string, null given, called in /var/www/nextcloud/apps/files_sharing/lib/DefaultPublicShareTemplateProvider.php on line 235",
      "Code": 0,
      "Trace": [
        {
          "file": "/var/www/nextcloud/apps/files_sharing/lib/DefaultPublicShareTemplateProvider.php",
          "line": 235,
          "function": "setHeaderTitle",
          "class": "OCP\\AppFramework\\Http\\Template\\PublicTemplateResponse",
          "type": "->"
        },
        {
          "file": "/var/www/nextcloud/apps/files_sharing/lib/Controller/ShareController.php",
          "line": 308,
          "function": "renderPage",
          "class": "OCA\\Files_Sharing\\DefaultPublicShareTemplateProvider",
          "type": "->"
        },
        {
          "file": "/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php",
          "line": 208,
          "function": "showShare",
          "class": "OCA\\Files_Sharing\\Controller\\ShareController",
          "type": "->"
        },
        {
          "file": "/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php",
          "line": 114,
          "function": "executeController",
          "class": "OC\\AppFramework\\Http\\Dispatcher",
          "type": "->"
        },
        {
          "file": "/var/www/nextcloud/lib/private/AppFramework/App.php",
          "line": 161,
          "function": "dispatch",
          "class": "OC\\AppFramework\\Http\\Dispatcher",
          "type": "->"
        },
        {
          "file": "/var/www/nextcloud/lib/private/Route/Router.php",
          "line": 302,
          "function": "main",
          "class": "OC\\AppFramework\\App",
          "type": "::"
        },
        {
          "file": "/var/www/nextcloud/lib/base.php",
          "line": 1001,
          "function": "match",
          "class": "OC\\Route\\Router",
          "type": "->"
        },
        {
          "file": "/var/www/nextcloud/index.php",
          "line": 24,
          "function": "handleRequest",
          "class": "OC",
          "type": "::"
        }
      ],
      "File": "/var/www/nextcloud/lib/public/AppFramework/Http/Template/PublicTemplateResponse.php",
      "Line": 45
    },
    "message": "OCP\\AppFramework\\Http\\Template\\PublicTemplateResponse::setHeaderTitle(): Argument #1 ($title) must be of type string, null given, called in /var/www/nextcloud/apps/files_sharing/lib/DefaultPublicShareTemplateProvider.php on line 235 in file '/var/www/nextcloud/lib/public/AppFramework/Http/Template/PublicTemplateResponse.php' line 45",
    "exception": [],
    "CustomMessage": "OCP\\AppFramework\\Http\\Template\\PublicTemplateResponse::setHeaderTitle(): Argument #1 ($title) must be of type string, null given, called in /var/www/nextcloud/apps/files_sharing/lib/DefaultPublicShareTemplateProvider.php on line 235 in file '/var/www/nextcloud/lib/public/AppFramework/Http/Template/PublicTemplateResponse.php' line 45"
  },
  "id": "670676f9e6691"
}

Additional info

if I read the error correctly, setHeaderTitle() is called with a null value (rather than a string), and PHP8.2 is a bit more picky about this.

I guess that the share is really old and was not assigned a title/label back then.

I've tried running various maintenance tasks (including maintenance:repair --include-expensive, db:add-missing-columns; files:repair - but really every command that looked like it could fix potential problems), to no avail.

@umlaeute umlaeute added 0. Needs triage Pending check for reproducibility or if it fits our roadmap bug labels Oct 9, 2024
@umlaeute
Copy link
Author

umlaeute commented Oct 9, 2024

The issue can apparently be worked around by changing the label in the backend database from null to an empty string:

UPDATE oc_share SET label = '' WHERE label IS null AND token IS NOT null;

However, I guess this ought to be done somewhat automatically by the maintenance scripts.

EDIT Also given that the default value for the label column says (according to postgresql): NULL::character varying, i think that NULL should actually be an allowed value and handled gracefully (either by PublicTemplateResponse::setHeaderTitle() or by whoever calls this function)

@miukumac
Copy link

miukumac commented Oct 9, 2024

Can confirm this same issue on our install, the only varying factor is that we use MariaDB and not PostgreSQL.

Same PHP version too and also similar upgrade path taken.

@myomv100
Copy link

myomv100 commented Oct 9, 2024

Disable files_downloadlimit app.

@umlaeute
Copy link
Author

umlaeute commented Oct 9, 2024

@myomv100 care to explain?

@myomv100
Copy link

myomv100 commented Oct 9, 2024

@umlaeute I had a similar issue with download limiter enabled in NC30. If disabling it solved my problem and yours then , there is something needs to be done to the download limiter app to make it compatible with NC30.

That's all I know.

@umlaeute
Copy link
Author

you probably should report it as a separate issue then (unless they are indeed related, which i cannot test any more, as i have replaced all my null values with empty strings as indicated above; maybe @miukumac can still check whether disabling files_downloadlimit helps with this particular issue)

@miukumac
Copy link

miukumac commented Oct 10, 2024

I disabled the addon and asked one of our users to test this but I have a feeling this is not related to the problem here.

I haven't nulled the DB yet myself so I can test various things on it.

Edit: This did not fix the issue. Most likely it's the same NULL value issue as umlaeuteop has.

@joshtrichards joshtrichards changed the title [Bug]: Sharing links broken after upgrade to NC-30 [Bug]: Sharing links with null labels broken after upgrade to NC-30 Oct 10, 2024
susnux added a commit that referenced this issue Oct 12, 2024
* Resolves: #48629

While the database supports NULL, the typing has always said it only returns *string*.
So to not break any apps that might trust the typings we should return `''` if the database is set to `NULL`.

Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
@antoninchadima
Copy link

I have exactly the same problem and i dont have installed the files_downloadlimit

and it only affects links shared more then 2 years ago...

@susnux susnux closed this as completed in 2e4d3e4 Oct 14, 2024
backportbot bot pushed a commit that referenced this issue Oct 14, 2024
* Resolves: #48629

While the database supports NULL, the typing has always said it only returns *string*.
So to not break any apps that might trust the typings we should return `''` if the database is set to `NULL`.

Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
backportbot bot pushed a commit that referenced this issue Oct 14, 2024
* Resolves: #48629

While the database supports NULL, the typing has always said it only returns *string*.
So to not break any apps that might trust the typings we should return `''` if the database is set to `NULL`.

Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
susnux added a commit that referenced this issue Oct 15, 2024
* Resolves: #48629

While the database supports NULL, the typing has always said it only returns *string*.
So to not break any apps that might trust the typings we should return `''` if the database is set to `NULL`.

Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
@chriscroome
Copy link

I have had a client with this issue, disabling the the files_downloadlimit app didn't help and nor did the MySQL update suggestion, however the suggestion to delete and recreate the shares has solved it...

@umlaeute
Copy link
Author

nor did the MySQL update suggestion,

(I was using PostgreSQL, though the update suggestion is pure SQL anyhow)

@chriscroome out of interest: which DB is the client using? (most DBs distinguish between NULL and empty strings, but some do not - most notably oracle)

@susnux
Copy link
Contributor

susnux commented Oct 16, 2024

Fixed in current master, 29.0.9 and 30.0.2.
If you encounter a similar bug after upgrading to one of those versions (scheduled for November), please open a new issue.
For general purpose discussions please use https://help.nextcloud.com/

@nextcloud nextcloud locked as resolved and limited conversation to collaborators Oct 16, 2024
backportbot bot pushed a commit that referenced this issue Oct 16, 2024
* Resolves: #48629

While the database supports NULL, the typing has always said it only returns *string*.
So to not break any apps that might trust the typings we should return `''` if the database is set to `NULL`.

Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
susnux added a commit that referenced this issue Oct 16, 2024
* Resolves: #48629

While the database supports NULL, the typing has always said it only returns *string*.
So to not break any apps that might trust the typings we should return `''` if the database is set to `NULL`.

Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
susnux added a commit that referenced this issue Oct 17, 2024
* Resolves: #48629

While the database supports NULL, the typing has always said it only returns *string*.
So to not break any apps that might trust the typings we should return `''` if the database is set to `NULL`.

Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
susnux added a commit that referenced this issue Oct 17, 2024
* Resolves: #48629

While the database supports NULL, the typing has always said it only returns *string*.
So to not break any apps that might trust the typings we should return `''` if the database is set to `NULL`.

Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
susnux added a commit that referenced this issue Oct 17, 2024
* Resolves: #48629

While the database supports NULL, the typing has always said it only returns *string*.
So to not break any apps that might trust the typings we should return `''` if the database is set to `NULL`.

Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
0. Needs triage Pending check for reproducibility or if it fits our roadmap 30-feedback bug feature: sharing
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants