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]: Contacts menu broken if uids in oc_cards contain slashes #45260

Open
5 of 8 tasks
michaellass opened this issue May 10, 2024 · 3 comments
Open
5 of 8 tasks

[Bug]: Contacts menu broken if uids in oc_cards contain slashes #45260

michaellass opened this issue May 10, 2024 · 3 comments
Labels
0. Needs triage Pending check for reproducibility or if it fits our roadmap 28-feedback bug

Comments

@michaellass
Copy link

⚠️ This issue respects the following points: ⚠️

Bug description

Some contacts stored in the oc_cards table of my Nextcloud instance have a URL as uid. This breaks the contacts menu and causes the following warning in nextcloud.log:

Parameter "contact" for route "contacts.contacts.direct" must match "[^/]++" ("https://Username@mycloud.example.org/remote.php/carddav/addressbooks/Username/contacts/d9efda0aea.vcf~contacts" given) to generate a corresponding URL.
Full error message (formatted and slightly anonymized)
{
    "reqId": "Lin5UlVlVkZHuCShLZem",
    "level": 3,
    "time": "2024-05-10T09:25:33+00:00",
    "remoteAddr": "0.0.0.0", // anonymized
    "user": "Username", // anonymized
    "app": "index",
    "method": "POST",
    "url": "/index.php/contactsmenu/contacts",
    "message": "Parameter \"contact\" for route \"contacts.contacts.direct\" must match \"[^/]++\" (\"https://Username@mycloud.example.org/remote.php/carddav/addressbooks/Username/contacts/d9efda0aea.vcf~contacts\" given) to generate a corresponding URL.",
    "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:125.0) Gecko/20100101 Firefox/125.0",
    "version": "28.0.5.1",
    "exception": {
        "Exception": "Symfony\\Component\\Routing\\Exception\\InvalidParameterException",
        "Message": "Parameter \"contact\" for route \"contacts.contacts.direct\" must match \"[^/]++\" (\"https://Username@mycloud.example.org/remote.php/carddav/addressbooks/Username/contacts/d9efda0aea.vcf~contacts\" given) to generate a corresponding URL.",
        "Code": 0,
        "Trace": [{
            "file": "/var/www/nextcloud/3rdparty/symfony/routing/Generator/UrlGenerator.php",
            "line": 161,
            "function": "doGenerate",
            "class": "Symfony\\Component\\Routing\\Generator\\UrlGenerator",
            "type": "->"
        }, {
            "file": "/var/www/nextcloud/lib/private/Route/Router.php",
            "line": 372,
            "function": "generate",
            "class": "Symfony\\Component\\Routing\\Generator\\UrlGenerator",
            "type": "->"
        }, {
            "file": "/var/www/nextcloud/lib/private/Route/CachingRouter.php",
            "line": 65,
            "function": "generate",
            "class": "OC\\Route\\Router",
            "type": "->"
        }, {
            "file": "/var/www/nextcloud/lib/private/URLGenerator.php",
            "line": 103,
            "function": "generate",
            "class": "OC\\Route\\CachingRouter",
            "type": "->"
        }, {
            "file": "/var/www/nextcloud/apps/contacts/lib/ContactsMenu/Providers/DetailsProvider.php",
            "line": 112,
            "function": "linkToRoute",
            "class": "OC\\URLGenerator",
            "type": "->"
        }, {
            "file": "/var/www/nextcloud/lib/private/Contacts/ContactsMenu/Manager.php",
            "line": 114,
            "function": "process",
            "class": "OCA\\Contacts\\ContactsMenu\\Providers\\DetailsProvider",
            "type": "->"
        }, {
            "file": "/var/www/nextcloud/lib/private/Contacts/ContactsMenu/Manager.php",
            "line": 58,
            "function": "processEntries",
            "class": "OC\\Contacts\\ContactsMenu\\Manager",
            "type": "->"
        }, {
            "file": "/var/www/nextcloud/core/Controller/ContactsMenuController.php",
            "line": 51,
            "function": "getEntries",
            "class": "OC\\Contacts\\ContactsMenu\\Manager",
            "type": "->"
        }, {
            "file": "/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php",
            "line": 230,
            "function": "index",
            "class": "OC\\Core\\Controller\\ContactsMenuController",
            "type": "->"
        }, {
            "file": "/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php",
            "line": 137,
            "function": "executeController",
            "class": "OC\\AppFramework\\Http\\Dispatcher",
            "type": "->"
        }, {
            "file": "/var/www/nextcloud/lib/private/AppFramework/App.php",
            "line": 184,
            "function": "dispatch",
            "class": "OC\\AppFramework\\Http\\Dispatcher",
            "type": "->"
        }, {
            "file": "/var/www/nextcloud/lib/private/Route/Router.php",
            "line": 315,
            "function": "main",
            "class": "OC\\AppFramework\\App",
            "type": "::"
        }, {
            "file": "/var/www/nextcloud/lib/base.php",
            "line": 1069,
            "function": "match",
            "class": "OC\\Route\\Router",
            "type": "->"
        }, {
            "file": "/var/www/nextcloud/index.php",
            "line": 39,
            "function": "handleRequest",
            "class": "OC",
            "type": "::"
        }],
        "File": "/var/www/nextcloud/3rdparty/symfony/routing/Generator/UrlGenerator.php",
        "Line": 194,
        "message": "Parameter \"contact\" for route \"contacts.contacts.direct\" must match \"[^/]++\" (\"https://Username@mycloud.example.org/remote.php/carddav/addressbooks/Username/contacts/d9efda0aea.vcf~contacts\" given) to generate a corresponding URL.",
        "exception": {},
        "CustomMessage": "Parameter \"contact\" for route \"contacts.contacts.direct\" must match \"[^/]++\" (\"https://Username@mycloud.example.org/remote.php/carddav/addressbooks/Username/contacts/d9efda0aea.vcf~contacts\" given) to generate a corresponding URL."
    }
}

The entry with uri "d9efda0aea.vcf" in the oc_cards table in this example has a uid of "https://Username@mycloud.example.org/remote.php/carddav/addressbooks/Username/contacts/d9efda0aea.vcf".

Steps to reproduce

  1. Create a contact with a uid that contains slashes (e.g., a URL). I don't know how these entries were created in my case.
  2. Log into the Nextcloud web interface.

Expected behavior

No errors should be produced and the contacts menu should work.

Installation method

None

Nextcloud Server version

28

Operating system

Debian/Ubuntu

PHP engine version

PHP 8.2

Web server

Nginx

Database engine version

MariaDB

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?

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

Configuration report

{
    "system": {
        "instanceid": "***REMOVED SENSITIVE VALUE***",
        "passwordsalt": "***REMOVED SENSITIVE VALUE***",
        "datadirectory": "***REMOVED SENSITIVE VALUE***",
        "dbtype": "mysql",
        "version": "28.0.5.1",
        "dbname": "***REMOVED SENSITIVE VALUE***",
        "dbhost": "***REMOVED SENSITIVE VALUE***",
        "dbtableprefix": "oc_",
        "dbuser": "***REMOVED SENSITIVE VALUE***",
        "dbpassword": "***REMOVED SENSITIVE VALUE***",
        "installed": true,
        "loglevel": 0,
        "theme": "",
        "maintenance": false,
        "trusted_domains": [
            "***REMOVED SENSITIVE VALUE***"
        ],
        "secret": "***REMOVED SENSITIVE VALUE***",
        "trashbin_retention_obligation": "auto, 30",
        "versions_retention_obligation": "auto, 30",
        "updatechecker": true,
        "appstore.experimental.enabled": false,
        "mail_smtpmode": "smtp",
        "overwrite.cli.url": "***REMOVED SENSITIVE VALUE***",
        "mail_from_address": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpauthtype": "PLAIN",
        "mail_domain": "***REMOVED SENSITIVE VALUE***",
        "mail_smtphost": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpport": "25",
        "updater.release.channel": "stable",
        "mysql.utf8mb4": true,
        "memcache.local": "\\OC\\Memcache\\Redis",
        "memcache.locking": "\\OC\\Memcache\\Redis",
        "redis": {
            "host": "***REMOVED SENSITIVE VALUE***",
            "port": 0,
            "dbindex": 0,
            "password": "***REMOVED SENSITIVE VALUE***",
            "timeout": 1.5
        },
        "default_phone_region": "DE",
        "preview_max_x": 1024,
        "preview_max_y": 1024,
        "preview_max_filesize_image": 5,
        "maintenance_window_start": 2
    }
}

List of activated Apps

Enabled:
  - activity: 2.20.0
  - calendar: 4.7.3
  - cloud_federation_api: 1.11.0
  - contacts: 5.5.3
  - dav: 1.29.1
  - federatedfilesharing: 1.18.0
  - files: 2.0.0
  - files_pdfviewer: 2.9.0
  - files_reminders: 1.1.0
  - files_sharing: 1.20.0
  - files_trashbin: 1.18.0
  - files_versions: 1.21.0
  - logreader: 2.13.0
  - lookup_server_connector: 1.16.0
  - notes: 4.10.0
  - notifications: 2.16.0
  - oauth2: 1.16.3
  - password_policy: 1.18.0
  - photos: 2.4.0
  - privacy: 1.12.0
  - provisioning_api: 1.18.0
  - recommendations: 2.0.0
  - related_resources: 1.3.0
  - settings: 1.10.1
  - sharebymail: 1.18.0
  - survey_client: 1.16.0
  - tasks: 0.16.0
  - text: 3.9.1
  - theming: 2.3.0
  - twofactor_backupcodes: 1.17.0
  - twofactor_totp: 10.0.0-beta.2
  - updatenotification: 1.18.0
  - viewer: 2.2.0
  - workflowengine: 2.10.0
Disabled:
  - admin_audit: 1.18.0
  - bruteforcesettings: 2.8.0 (installed 1.0.2)
  - circles: 28.0.0 (installed 27.0.1)
  - comments: 1.18.0 (installed 1.17.0)
  - contactsinteraction: 1.9.0 (installed 1.8.0)
  - dashboard: 7.8.0 (installed 7.7.0)
  - encryption: 2.16.0
  - federation: 1.18.0 (installed 1.17.0)
  - files_external: 1.20.0
  - firstrunwizard: 2.17.0 (installed 2.16.0)
  - nextcloud_announcements: 1.17.0 (installed 1.16.0)
  - serverinfo: 1.18.0 (installed 1.17.0)
  - support: 1.11.1 (installed 1.10.0)
  - suspicious_login: 6.0.0
  - systemtags: 1.18.0 (installed 1.17.0)
  - user_ldap: 1.19.0
  - user_status: 1.8.1 (installed 1.7.0)
  - weather_status: 1.8.0 (installed 1.7.0)

Nextcloud Signing status

No errors have been found.

Nextcloud Logs

(see problem description)

Additional info

No response

@michaellass michaellass added 0. Needs triage Pending check for reproducibility or if it fits our roadmap bug labels May 10, 2024
@ShivaSystem
Copy link

I have exactly the same problem

@pswilde
Copy link

pswilde commented May 21, 2024

I've been having this same problem, it's a real nuisance error message, but I don't think it has any real impact on anything - but I am certainly no expert!

Anyway, I think I've got rid of my error here by doing a bit of database admin:
I use postgres as db backend, but the basic statements should be the same.
first, find the properties that have a slash in them:

select * from oc_cards_properties where name = 'UID' and value like '%/%';

this will likely show you a list of contact properties where the UID contains a slash - take note of the "cardid" for them all
Then, take a record of the contact properties of the above:

select * from oc_cards_properties where cardid in ( ## a comma separated list of the ids from the previous select statement, i.e. 10,42,43... ## );

take note of this information, as you're going to delete the contact and re-add it
delete the problem contacts

delete from oc_cards_properties where cardid in (## comma separated id list as above ##);
# and #
delete from oc_cards where cardid in (## comma separated id list as above ##);

That should remove the problem contacts from the database, then just simply re-add the contacts from the nextcloud contacts front end - they should get added with correct UIDs without slashes

Of course, this assumes you have access to the database, if you don't then I'm not really sure what you can do here as you can't even delete the contacts as they won't be showing in the contacts list.

@michaellass
Copy link
Author

Of course, this assumes you have access to the database, if you don't then I'm not really sure what you can do here as you can't even delete the contacts as they won't be showing in the contacts list.

For me, all contacts are shown correctly in the Contacts app and can be accessed. I think it is just the contacts menu (and maybe the global search) in the Nextcloud main interface that struggles with this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0. Needs triage Pending check for reproducibility or if it fits our roadmap 28-feedback bug
Projects
None yet
Development

No branches or pull requests

4 participants