Skip to content

[Bug]: Unsharing is not possible when maps are enabled #1493

@melboone

Description

@melboone

⚠️ This issue respects the following points: ⚠️

Bug description

When maps is enabled, after sharing a document, unshare is not working/possible.

This has been observed by others and found out that that this package was the culprit from Reddit.

Steps to reproduce

  1. Enable maps
  2. Share a document (either public or email)
  3. Unshare a document

Expected behavior

I expected the share to be removed.

Installation method

Official All-in-One appliance

Operating system

Other

PHP engine version

None

Web server

Apache (supported)

Database engine version

None

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

Fresh Nextcloud Server install

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?

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

Configuration report

List of activated Apps

Enabled:
  - activity: 5.0.0-dev.0
  - admin_audit: 1.22.0
  - assistant: 2.12.0
  - bruteforcesettings: 5.0.0-dev.0
  - cloud_federation_api: 1.16.0
  - comments: 1.22.0
  - dav: 1.34.2
  - deck: 1.16.3
  - federatedfilesharing: 1.22.0
  - federation: 1.22.0
  - files: 2.4.0
  - files_antivirus: 6.1.0
  - files_downloadlimit: 5.0.0-dev.0
  - files_fulltextsearch: 32.0.2
  - files_pdfviewer: 5.0.0-dev.0
  - files_reminders: 1.5.0
  - files_sharing: 1.24.1
  - files_trashbin: 1.22.0
  - files_versions: 1.25.0
  - fulltextsearch: 32.0.0
  - fulltextsearch_elasticsearch: 32.0.2
  - integration_openai: 3.10.0
  - logreader: 5.0.0-dev.0
  - lookup_server_connector: 1.20.0
  - maps: 1.6.0
  - nextcloud-aio: 0.8.0
  - nextcloud_announcements: 4.0.0-dev.0
  - notes: 4.12.4
  - notifications: 5.0.0-dev.0
  - notify_push: 1.3.0
  - oauth2: 1.20.0
  - onlyoffice: 9.12.0
  - password_policy: 4.0.0-dev.0
  - photos: 5.0.0-dev.1
  - privacy: 4.0.0-dev.0
  - profile: 1.1.0
  - provisioning_api: 1.22.0
  - recommendations: 5.0.0-dev.0
  - related_resources: 3.0.0-dev.0
  - serverinfo: 4.0.0-dev.0
  - settings: 1.15.1
  - sharebymail: 1.22.0
  - systemtags: 1.22.0
  - tasks: 0.17.1
  - text: 6.0.1
  - theming: 2.7.0
  - twofactor_backupcodes: 1.21.0
  - twofactor_totp: 14.0.0
  - updatenotification: 1.22.0
  - user_status: 1.12.0
  - viewer: 5.0.0-dev.0
  - webhook_listeners: 1.3.0
  - workflowengine: 2.14.0
Disabled:
  - app_api: 32.0.0 (installed 32.0.0)
  - calendar: 6.1.5 (installed 6.1.5)
  - circles: 32.0.0 (installed 32.0.0)
  - contacts: 8.3.0 (installed 8.3.0)
  - contactsinteraction: 1.13.1 (installed 1.13.1)
  - dashboard: 7.12.0 (installed 7.12.0)
  - encryption: 2.20.0
  - files_external: 1.24.0
  - firstrunwizard: 5.0.0-dev.0 (installed 5.0.0-dev.0)
  - gpxpod: 7.2.4 (installed 7.2.4)
  - support: 4.0.0-dev.0 (installed 4.0.0-dev.0)
  - survey_client: 4.0.0-dev.0 (installed 4.0.0-dev.0)
  - suspicious_login: 10.0.0-dev.0
  - twofactor_nextcloud_notification: 6.0.0-dev.0
  - user_ldap: 1.23.0
  - weather_status: 1.12.0 (installed 1.12.0)

Nextcloud Signing status

Nextcloud Logs

 Exception Undefined constant OCP\Share::SHARE_TYPE_USER in file '/var/www/html/custom_apps/maps/lib/Hooks/FileHooks.php' line 154

    /var/www/html/lib/private/AppFramework/App.phpLine 153

    OC\AppFramework\Http\Dispatcher->dispatch(
      {
        "__class__": "OCA\\Files_Sharing\\Controller\\ShareAPIController"
      },
      "deleteShare"
    )

    /var/www/html/lib/private/Route/Router.phpLine 321

    OC\AppFramework\App::main(
      "OCA\\Files_Sharing\\Controller\\ShareAPIController",
      "deleteShare",
      {
        "__class__": "OC\\AppFramework\\DependencyInjection\\DIContainer"
      },
      {
        "_route": "ocs.files_sharing.shareapi.deleteshare",
        "id": "11"
      }
    )

    /var/www/html/ocs/v1.phpLine 61

    OC\Route\Router->match(
      "/ocsapp/apps/files_sharing/api/v1/shares/11"
    )

    /var/www/html/ocs/v2.phpLine 8

    undefinedundefinedrequire_once(
      "/var/www/html/ocs/v1.php"
    )

Caused by Error Undefined constant OCP\Share::SHARE_TYPE_USER

{
  "reqId": "bQYQOnd3ZRj5plSeYxzX",
  "level": 3,
  "time": "2026-03-03T07:33:25+00:00",
  "remoteAddr": "195.86.27.30",
  "user": "admin",
  "app": "no app in context",
  "method": "DELETE",
  "url": "/ocs/v2.php/apps/files_sharing/api/v1/shares/11",
  "scriptName": "/ocs/v2.php",
  "message": "Undefined constant OCP\\Share::SHARE_TYPE_USER in file '/var/www/html/custom_apps/maps/lib/Hooks/FileHooks.php' line 154",
  "userAgent": "Mozilla/5.0 (X11; Linux x86_64; rv:148.0) Gecko/20100101 Firefox/148.0",
  "version": "32.0.4.1",
  "exception": {
    "Exception": "Exception",
    "Message": "Undefined constant OCP\\Share::SHARE_TYPE_USER in file '/var/www/html/custom_apps/maps/lib/Hooks/FileHooks.php' line 154",
    "Code": 0,
    "Trace": [
      {
        "file": "/var/www/html/lib/private/AppFramework/App.php",
        "line": 153,
        "function": "dispatch",
        "class": "OC\\AppFramework\\Http\\Dispatcher",
        "type": "->",
        "args": [
          {
            "__class__": "OCA\\Files_Sharing\\Controller\\ShareAPIController"
          },
          "deleteShare"
        ]
      },
      {
        "file": "/var/www/html/lib/private/Route/Router.php",
        "line": 321,
        "function": "main",
        "class": "OC\\AppFramework\\App",
        "type": "::",
        "args": [
          "OCA\\Files_Sharing\\Controller\\ShareAPIController",
          "deleteShare",
          {
            "__class__": "OC\\AppFramework\\DependencyInjection\\DIContainer"
          },
          {
            "_route": "ocs.files_sharing.shareapi.deleteshare",
            "id": "11"
          }
        ]
      },
      {
        "file": "/var/www/html/ocs/v1.php",
        "line": 61,
        "function": "match",
        "class": "OC\\Route\\Router",
        "type": "->",
        "args": [
          "/ocsapp/apps/files_sharing/api/v1/shares/11"
        ]
      },
      {
        "file": "/var/www/html/ocs/v2.php",
        "line": 8,
        "args": [
          "/var/www/html/ocs/v1.php"
        ],
        "function": "require_once"
      }
    ],
    "File": "/var/www/html/lib/private/AppFramework/Http/Dispatcher.php",
    "Line": 150,
    "Previous": {
      "Exception": "Error",
      "Message": "Undefined constant OCP\\Share::SHARE_TYPE_USER",
      "Code": 0,
      "Trace": [
        {
          "file": "/var/www/html/lib/private/legacy/OC_Hook.php",
          "line": 85,
          "function": "preUnShare",
          "class": "OCA\\Maps\\Hooks\\FileHooks",
          "type": "->",
          "args": [
            {
              "0": "And 4 more entries, set log level to debug to see all entries",
              "id": "11",
              "itemType": "file",
              "itemSource": 96841,
              "shareType": 3,
              "shareWith": ""
            }
          ]
        },
        {
          "file": "/var/www/html/lib/private/Share20/LegacyHooks.php",
          "line": 47,
          "function": "emit",
          "class": "OC_Hook",
          "type": "::",
          "args": [
            "OCP\\Share",
            "pre_unshare",
            {
              "0": "And 4 more entries, set log level to debug to see all entries",
              "id": "11",
              "itemType": "file",
              "itemSource": 96841,
              "shareType": 3,
              "shareWith": ""
            }
          ]
        },
        {
          "file": "/var/www/html/lib/private/Share20/LegacyHooks.php",
          "line": 27,
          "function": "preUnshare",
          "class": "OC\\Share20\\LegacyHooks",
          "type": "->",
          "args": [
            "*** sensitive parameters replaced ***"
          ]
        },
        {
          "file": "/var/www/html/3rdparty/symfony/event-dispatcher/EventDispatcher.php",
          "line": 220,
          "function": "OC\\Share20\\{closure}",
          "class": "OC\\Share20\\LegacyHooks",
          "type": "->",
          "args": [
            "*** sensitive parameters replaced ***"
          ]
        },
        {
          "file": "/var/www/html/3rdparty/symfony/event-dispatcher/EventDispatcher.php",
          "line": 56,
          "function": "callListeners",
          "class": "Symfony\\Component\\EventDispatcher\\EventDispatcher",
          "type": "->",
          "args": [
            [
              {
                "__class__": "Closure"
              },
              {
                "__class__": "Closure"
              }
            ],
            "*** sensitive parameters replaced ***",
            "*** sensitive parameters replaced ***"
          ]
        },
        {
          "file": "/var/www/html/lib/private/EventDispatcher/EventDispatcher.php",
          "line": 67,
          "function": "dispatch",
          "class": "Symfony\\Component\\EventDispatcher\\EventDispatcher",
          "type": "->",
          "args": [
            "*** sensitive parameters replaced ***",
            "*** sensitive parameters replaced ***"
          ]
        },
        {
          "file": "/var/www/html/lib/private/EventDispatcher/EventDispatcher.php",
          "line": 79,
          "function": "dispatch",
          "class": "OC\\EventDispatcher\\EventDispatcher",
          "type": "->",
          "args": [
            "*** sensitive parameters replaced ***",
            "*** sensitive parameters replaced ***"
          ]
        },
        {
          "file": "/var/www/html/lib/private/Share20/Manager.php",
          "line": 2098,
          "function": "dispatchTyped",
          "class": "OC\\EventDispatcher\\EventDispatcher",
          "type": "->",
          "args": [
            "*** sensitive parameters replaced ***"
          ]
        },
        {
          "file": "/var/www/html/lib/private/Share20/Manager.php",
          "line": 1135,
          "function": "dispatchEvent",
          "class": "OC\\Share20\\Manager",
          "type": "->",
          "args": [
            "*** sensitive parameters replaced ***",
            "before share deleted"
          ]
        },
        {
          "file": "/var/www/html/apps/files_sharing/lib/Controller/ShareAPIController.php",
          "line": 565,
          "function": "deleteShare",
          "class": "OC\\Share20\\Manager",
          "type": "->",
          "args": [
            {
              "__class__": "OC\\Share20\\Share"
            }
          ]
        },
        {
          "file": "/var/www/html/lib/private/AppFramework/Http/Dispatcher.php",
          "line": 204,
          "function": "deleteShare",
          "class": "OCA\\Files_Sharing\\Controller\\ShareAPIController",
          "type": "->",
          "args": [
            "11"
          ]
        },
        {
          "file": "/var/www/html/lib/private/AppFramework/Http/Dispatcher.php",
          "line": 118,
          "function": "executeController",
          "class": "OC\\AppFramework\\Http\\Dispatcher",
          "type": "->",
          "args": [
            {
              "__class__": "OCA\\Files_Sharing\\Controller\\ShareAPIController"
            },
            "deleteShare"
          ]
        },
        {
          "file": "/var/www/html/lib/private/AppFramework/App.php",
          "line": 153,
          "function": "dispatch",
          "class": "OC\\AppFramework\\Http\\Dispatcher",
          "type": "->",
          "args": [
            {
              "__class__": "OCA\\Files_Sharing\\Controller\\ShareAPIController"
            },
            "deleteShare"
          ]
        },
        {
          "file": "/var/www/html/lib/private/Route/Router.php",
          "line": 321,
          "function": "main",
          "class": "OC\\AppFramework\\App",
          "type": "::",
          "args": [
            "OCA\\Files_Sharing\\Controller\\ShareAPIController",
            "deleteShare",
            {
              "__class__": "OC\\AppFramework\\DependencyInjection\\DIContainer"
            },
            {
              "_route": "ocs.files_sharing.shareapi.deleteshare",
              "id": "11"
            }
          ]
        },
        {
          "file": "/var/www/html/ocs/v1.php",
          "line": 61,
          "function": "match",
          "class": "OC\\Route\\Router",
          "type": "->",
          "args": [
            "/ocsapp/apps/files_sharing/api/v1/shares/11"
          ]
        },
        {
          "file": "/var/www/html/ocs/v2.php",
          "line": 8,
          "args": [
            "/var/www/html/ocs/v1.php"
          ],
          "function": "require_once"
        }
      ],
      "File": "/var/www/html/custom_apps/maps/lib/Hooks/FileHooks.php",
      "Line": 154
    },
    "message": "Undefined constant OCP\\Share::SHARE_TYPE_USER in file '/var/www/html/custom_apps/maps/lib/Hooks/FileHooks.php' line 154",
    "exception": [],
    "CustomMessage": "Undefined constant OCP\\Share::SHARE_TYPE_USER in file '/var/www/html/custom_apps/maps/lib/Hooks/FileHooks.php' line 154"
  },
  "id": "69a68ed363b4d"
}

Browser Console

Additional info

log.txt

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions