maps icon indicating copy to clipboard operation
maps copied to clipboard

[Bug]: Parameter "contact" for route "contacts.contacts.direct" must match "[^/]++" to generate a corresponding URL

Open michaellass opened this issue 2 months ago • 0 comments

⚠️ This issue respects the following points: ⚠️

Bug description

I'm getting the following error in my nextcloud.log when opening maps:

{
   "reqId":"LlkgIXN3ql0Z1ByYsFiB",
   "level":3,
   "time":"2025-10-20T18:51:57+00:00",
   "remoteAddr":**redacted**,
   "user":**redacted**,
   "app":"index",
   "method":"GET",
   "url":"/index.php/apps/maps/contacts",
   "message":"Parameter \"contact\" for route \"contacts.contacts.direct\" must match \"[^/]++\" (\"**redacted**\" given) to generate a corresponding URL.",
   "userAgent":"Mozilla/5.0 (X11; Linux x86_64; rv:144.0) Gecko/20100101 Firefox/144.0",
   "version":"31.0.9.1",
   "exception":{
      "Exception":"Symfony\\Component\\Routing\\Exception\\InvalidParameterException",
      "Message":"Parameter \"contact\" for route \"contacts.contacts.direct\" must match \"[^/]++\" (\"**redacted**\" given) to generate a corresponding URL.",
      "Code":0,
      "Trace":[
         {
            "file":"**redacted**/3rdparty/symfony/routing/Generator/UrlGenerator.php",
            "line":151,
            "function":"doGenerate",
            "class":"Symfony\\Component\\Routing\\Generator\\UrlGenerator",
            "type":"->"
         },
         {
            "file":"**redacted**/lib/private/Route/Router.php",
            "line":379,
            "function":"generate",
            "class":"Symfony\\Component\\Routing\\Generator\\UrlGenerator",
            "type":"->"
         },
         {
            "file":"**redacted**/lib/private/Route/CachingRouter.php",
            "line":50,
            "function":"generate",
            "class":"OC\\Route\\Router",
            "type":"->"
         },
         {
            "file":"**redacted**/lib/private/URLGenerator.php",
            "line":81,
            "function":"generate",
            "class":"OC\\Route\\CachingRouter",
            "type":"->"
         },
         {
            "file":"**redacted**/apps/maps/lib/Controller/ContactsController.php",
            "line":320,
            "function":"linkToRoute",
            "class":"OC\\URLGenerator",
            "type":"->"
         },
         {
            "file":"**redacted**/apps/maps/lib/Controller/ContactsController.php",
            "line":151,
            "function":"directUrlToContact",
            "class":"OCA\\Maps\\Controller\\ContactsController",
            "type":"->"
         },
         {
            "file":"**redacted**/lib/private/AppFramework/Http/Dispatcher.php",
            "line":200,
            "function":"getContacts",
            "class":"OCA\\Maps\\Controller\\ContactsController",
            "type":"->"
         },
         {
            "file":"**redacted**/lib/private/AppFramework/Http/Dispatcher.php",
            "line":114,
            "function":"executeController",
            "class":"OC\\AppFramework\\Http\\Dispatcher",
            "type":"->"
         },
         {
            "file":"**redacted**/lib/private/AppFramework/App.php",
            "line":161,
            "function":"dispatch",
            "class":"OC\\AppFramework\\Http\\Dispatcher",
            "type":"->"
         },
         {
            "file":"**redacted**/lib/private/Route/Router.php",
            "line":315,
            "function":"main",
            "class":"OC\\AppFramework\\App",
            "type":"::"
         },
         {
            "file":"**redacted**/lib/base.php",
            "line":1063,
            "function":"match",
            "class":"OC\\Route\\Router",
            "type":"->"
         },
         {
            "file":"**redacted**/index.php",
            "line":24,
            "function":"handleRequest",
            "class":"OC",
            "type":"::"
         }
      ],
      "File":"**redacted**/3rdparty/symfony/routing/Generator/UrlGenerator.php",
      "Line":182,
      "message":"Parameter \"contact\" for route \"contacts.contacts.direct\" must match \"[^/]++\" (\"**redacted**\" given) to generate a corresponding URL.",
      "exception":{
         
      },
      "CustomMessage":"Parameter \"contact\" for route \"contacts.contacts.direct\" must match \"[^/]++\" (\"**redacted**\" given) to generate a corresponding URL."
   }
}

After similar issues with the contacts app (https://github.com/nextcloud/server/issues/45260, https://github.com/nextcloud/contacts/issues/4603), I assume that this is caused by contacts whose UID contain a slash. Note that URIs are explicitly allowed as UID and therefore also slashes: https://www.rfc-editor.org/rfc/rfc6350.html#section-6.7.6

This has preivously been fixed in the contacts app (https://github.com/nextcloud/contacts/pull/4615) by using a base64 encoding of the UID for routing, which is also used by the calendar app.

Steps to reproduce

I have no sandbox to test and cannot experiment with production data, but I expect the following steps to be able to reproduce the issue:

  1. Install and activate maps app
  2. Create a contact with a UID that contains a slash
  3. Open maps app

Expected behavior

No error message and the contact locations should be shown in the map.

Installation method

Manual installation

Operating system

Debian/Ubuntu

PHP engine version

Other

Web server

Nginx

Database engine version

MariaDB

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

Updated to a major version (ex. 22.2.3 to 23.0.1)

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

Fresh Nextcloud Maps install (never installed before)

Are you using the Nextcloud Server Encryption module?

Encryption is Disabled

What user-backends are you using?

  • [x] 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": "31.0.9.1",
        "dbname": "***REMOVED SENSITIVE VALUE***",
        "dbhost": "***REMOVED SENSITIVE VALUE***",
        "dbtableprefix": "oc_",
        "dbuser": "***REMOVED SENSITIVE VALUE***",
        "dbpassword": "***REMOVED SENSITIVE VALUE***",
        "installed": true,
        "loglevel": 2,
        "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.distributed": "\\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,
        "app_install_overwrite": []
    }
}

List of activated Apps

Enabled:
  - activity: 4.0.0
  - app_api: 5.0.2
  - calendar: 5.5.7
  - cloud_federation_api: 1.14.0
  - contacts: 7.3.4
  - dav: 1.33.0
  - federatedfilesharing: 1.21.0
  - files: 2.3.1
  - files_downloadlimit: 4.0.0
  - files_pdfviewer: 4.0.0
  - files_reminders: 1.4.0
  - files_sharing: 1.23.1
  - files_trashbin: 1.21.0
  - files_versions: 1.24.0
  - logreader: 4.0.0
  - lookup_server_connector: 1.19.0
  - maps: 1.6.0
  - notes: 4.12.3
  - notifications: 4.0.0
  - oauth2: 1.19.1
  - password_policy: 3.0.0
  - photos: 4.0.0
  - privacy: 3.0.0
  - profile: 1.0.0
  - provisioning_api: 1.21.0
  - recommendations: 4.0.0
  - related_resources: 2.0.0
  - richdocuments: 8.7.6
  - settings: 1.14.0
  - sharebymail: 1.21.0
  - survey_client: 3.0.0
  - tasks: 0.16.1
  - text: 5.0.0
  - theming: 2.6.1
  - twofactor_backupcodes: 1.20.0
  - twofactor_totp: 13.0.0-dev.0
  - updatenotification: 1.21.0
  - viewer: 4.0.0
  - webhook_listeners: 1.2.0
  - workflowengine: 2.13.0
Disabled:
  - admin_audit: 1.21.0
  - bruteforcesettings: 4.0.0 (installed 1.0.2)
  - circles: 31.0.0 (installed 27.0.1)
  - comments: 1.21.0 (installed 1.17.0)
  - contactsinteraction: 1.12.0 (installed 1.8.0)
  - dashboard: 7.11.0 (installed 7.7.0)
  - encryption: 2.19.0
  - federation: 1.21.0 (installed 1.17.0)
  - files_external: 1.23.0
  - firstrunwizard: 4.0.0 (installed 2.16.0)
  - nextcloud_announcements: 3.0.0 (installed 1.16.0)
  - serverinfo: 3.0.0 (installed 1.17.0)
  - support: 3.0.0 (installed 1.10.0)
  - suspicious_login: 9.0.1
  - systemtags: 1.21.1 (installed 1.17.0)
  - twofactor_nextcloud_notification: 5.0.0
  - user_ldap: 1.22.0
  - user_status: 1.11.0 (installed 1.7.0)
  - weather_status: 1.11.0 (installed 1.7.0)

Nextcloud Signing status

No errors have been found.

Nextcloud Logs

See bug description above.

Browser Console


Additional info

PHP version: 8.3

michaellass avatar Oct 20 '25 19:10 michaellass