Skip to content

[Bug]: Moving a shared directory corrupts user #56517

@RkernelX

Description

@RkernelX

⚠️ This issue respects the following points: ⚠️

Bug description

User foo shares a directory with user bar.
If user bar moves the shared directory to a subfolder, bar can not access any of its files anymore.

in the postgres log you will find something like:

db-1 | 2025-11-18 21:30:03.955 UTC [109] ERROR: duplicate key value violates unique constraint "idx_17419_mounts_user_root_index"
db-1 | 2025-11-18 21:30:03.955 UTC [109] DETAIL: Key (user_id, root_id)=(bar, 1234) already exists.
db-1 | 2025-11-18 21:30:03.955 UTC [109] STATEMENT: INSERT INTO "oc_mounts" ("storage_id","root_id","user_id","mount_point","mount_id","mount_provider_class") SELECT $1, $2, $3, $4, $5, $6 FROM "oc_mounts" WHERE "root_id" = $7 AND "user_id" = $8 AND "mount_point" = $9 HAVING COUNT(*) = 0
db-1 | 2025-11-18 21:30:03.956 UTC [109] ERROR: current transaction is aborted, commands ignored until end of transaction block

Steps to reproduce

  1. have user foo
  2. have user bar
  3. foo uploads some files in a directory "my samples"
  4. foo shares directory "my samples" with bar
  5. bar creates folder "dokuments"
  6. bar moves "my samples" using the webinterface in to folder "dokuments"
  7. bar log out
  8. bar log in
  9. PROBLEM!

After loging in in to the database, you can change the location by the command
update oc_mounts SET mount_point = '/bar/files/documents/my samples/' WHERE id = '1234' and user_id like 'bar';

Expected behavior

No manual interaction on the database to move the location.

Nextcloud Server version

32

Operating system

Debian/Ubuntu

PHP engine version

PHP 8.3

Web server

Apache (supported)

Database engine version

PostgreSQL

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": {
        "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
            }
        ],
        "memcache.distributed": "\\OC\\Memcache\\Redis",
        "memcache.locking": "\\OC\\Memcache\\Redis",
        "redis": {
            "host": "***REMOVED SENSITIVE VALUE***",
            "password": "***REMOVED SENSITIVE VALUE***",
            "port": 6379
        },
        "instanceid": "***REMOVED SENSITIVE VALUE***",
        "passwordsalt": "***REMOVED SENSITIVE VALUE***",
        "secret": "***REMOVED SENSITIVE VALUE***",
        "trusted_domains": [
            "***REMOVED SENSITIVE VALUE***",
            "***REMOVED SENSITIVE VALUE***",
            "***REMOVED SENSITIVE VALUE***"
        ],
        "trusted_proxies": "***REMOVED SENSITIVE VALUE***",
        "datadirectory": "***REMOVED SENSITIVE VALUE***",
        "dbtype": "pgsql",
        "version": "32.0.1.2",
        "overwrite.cli.url": "https:\/\/"***REMOVED SENSITIVE VALUE***"",
        "dbname": "***REMOVED SENSITIVE VALUE***",
        "dbhost": "***REMOVED SENSITIVE VALUE***",
        "dbport": "",
        "dbtableprefix": "oc_",
        "dbuser": "***REMOVED SENSITIVE VALUE***",
        "dbpassword": "***REMOVED SENSITIVE VALUE***",
        "installed": true,
        "loglevel": 2,
        "logfile": "\/var\/log\/nextcloud.log",
        "maintenance": false,
        "overwriteprotocol": "https",
        "theme": "",
        "default_phone_region": "DE",
        "OWNCLOUD_MAX_PARALLEL": 2,
        "mail_from_address": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpmode": "smtp",
        "mail_sendmailmode": "smtp",
        "mail_domain": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpauthtype": "LOGIN",
        "mail_smtpauth": 1,
        "mail_smtphost": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpport": "587",
        "mail_smtpsecure": "tls",
        "mail_smtpname": "***REMOVED SENSITIVE VALUE***",
        "mail_smtppassword": "***REMOVED SENSITIVE VALUE***",
        "preview_max_memory": 1280,
        "upgrade.disable-web": true,
        "maintenance_window_start": 4,
        "enabledPreviewProviders": [
            "OC\\Preview\\BMP",
            "OC\\Preview\\GIF",
            "OC\\Preview\\JPEG",
            "OC\\Preview\\MarkDown",
            "OC\\Preview\\OpenDocument",
            "OC\\Preview\\PNG",
            "OC\\Preview\\TXT",
            "OC\\Preview\\XBitmap"
        ],
        "forwarded_for_headers": [
            "HTTP_X_FORWARDED_FOR"
        ]
    }
}

List of activated Apps

Enabled:
  - activity: 5.0.0-dev.0
  - admin_audit: 1.22.0
  - bruteforcesettings: 5.0.0-dev.0
  - circles: 32.0.0
  - cloud_federation_api: 1.16.0
  - contactsinteraction: 1.13.1
  - dav: 1.34.2
  - federatedfilesharing: 1.22.0
  - files: 2.4.0
  - files_downloadlimit: 5.0.0-dev.0
  - files_external: 1.24.0
  - files_pdfviewer: 5.0.0-dev.0
  - files_reminders: 1.5.0
  - files_sharing: 1.24.0
  - files_trashbin: 1.22.0
  - files_versions: 1.25.0
  - firstrunwizard: 5.0.0-dev.0
  - logreader: 5.0.0-dev.0
  - lookup_server_connector: 1.20.0
  - nextcloud_announcements: 4.0.0-dev.0
  - notifications: 5.0.0-dev.0
  - oauth2: 1.20.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
  - support: 4.0.0-dev.0
  - survey_client: 4.0.0-dev.0
  - suspicious_login: 10.0.0-dev.0
  - systemtags: 1.22.0
  - 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
  - workflowengine: 2.14.0
Disabled:
  - app_api: 32.0.0 (installed 32.0.0)
  - comments: 1.22.0 (installed 1.14.0)
  - dashboard: 7.12.0 (installed 7.1.0)
  - encryption: 2.20.0
  - federation: 1.22.0 (installed 1.14.0)
  - twofactor_nextcloud_notification: 6.0.0-dev.0
  - user_ldap: 1.23.0
  - weather_status: 1.12.0 (installed 1.3.0)
  - webhook_listeners: 1.3.0 (installed 1.1.0-dev)

Nextcloud Signing status

No errors have been found.

Nextcloud Logs

db-1  | 2025-11-18 21:30:03.955 UTC [109] ERROR:  duplicate key value violates unique constraint "idx_17419_mounts_user_root_index"
db-1  | 2025-11-18 21:30:03.955 UTC [109] DETAIL:  Key (user_id, root_id)=(bar, 1234) already exists.
db-1  | 2025-11-18 21:30:03.955 UTC [109] STATEMENT:  INSERT INTO "oc_mounts" ("storage_id","root_id","user_id","mount_point","mount_id","mount_provider_class") SELECT $1, $2, $3, $4, $5, $6 FROM "oc_mounts" WHERE "root_id" = $7 AND "user_id" = $8 AND "mount_point" = $9 HAVING COUNT(*) = 0
db-1  | 2025-11-18 21:30:03.956 UTC [109] ERROR:  current transaction is aborted, commands ignored until end of transaction block

Additional info

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    0. Needs triagePending check for reproducibility or if it fits our roadmap32-feedbackbug

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions