nextcloud / nextcloud/server

[Bug]: renaming file by just changing case leads to strange results (on SMB storage and others)

Open
#40,690 6 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

0. Needs triage 27-feedback bug feature: external storage feature: filesystem hotspot: filename handling
Dominant language
PHP
Stars
36.9k
Forks
5.2k
Avg merge
2d 3h
Merged PRs (30d)
713

Description

⚠️ This issue respects the following points: ⚠️
Bug description

Renaming an object (here folder/directory) on external storage connected via SMB leads to strange results depending on the client.

WebGUI:

  • renaming 99_test to 99_TEST produces an error message saying that the name is already in use and that I should use a different name
  • HOWEVER: in the GUI one can see now both folders 99_test AND 99_TEST
  • if I create an object in 99_test it also shows in 99_TEST and vice versa
  • if I delete either of the folders then both are either deleted or one is deleted and the other dysfunctional (cannot create any files or folders inside it)
  • on the connected Nextcloud client on Windows the user can just see the original 99_test

Nextcloud client (Windows) with virtual files:

  • renaming 99_test to 99_TEST produces an error message saying that it failed caused by a protocol error
  • client sees folder as 99_test, sync status remains active
  • creating any objects in 99_test fails in client and WebGUI, folder is dysfunctional
Steps to reproduce
  1. create folder on external storage connected via SMB
  2. rename the folder by just changing the case of a letter
Expected behavior

renaming by just changing case is detected by WebGUI and Nextcloud client as illegal on SMB storage and no file operations are executed.

Installation method

Other Community project

Nextcloud Server version

27

Operating system

Debian/Ubuntu

PHP engine version

PHP 8.2

Web server

Nginx

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?

None

What user-backends are you using?
  • Default user-backend (database)
  • LDAP/ Active Directory
  • SSO - SAML
  • Other
Configuration report
{
    "system": {
        "memcache.local": "\\OC\\Memcache\\APCu",
        "memcache.distributed": "\\OC\\Memcache\\Redis",
        "filelocking.enabled": true,
        "memcache.locking": "\\OC\\Memcache\\Redis",
        "datadirectory": "***REMOVED SENSITIVE VALUE***",
        "instanceid": "***REMOVED SENSITIVE VALUE***",
        "passwordsalt": "***REMOVED SENSITIVE VALUE***",
        "secret": "***REMOVED SENSITIVE VALUE***",
        "trusted_domains": [
            "cloud.satzkiste.de"
        ],
        "dbtype": "pgsql",
        "version": "27.1.1.0",
        "overwrite.cli.url": "https:\/\/cloud.satzkiste.de",
        "dbname": "***REMOVED SENSITIVE VALUE***",
        "dbhost": "***REMOVED SENSITIVE VALUE***",
        "dbport": "",
        "dbtableprefix": "oc_",
        "mysql.utf8mb4": true,
        "dbuser": "***REMOVED SENSITIVE VALUE***",
        "dbpassword": "***REMOVED SENSITIVE VALUE***",
        "installed": true,
        "trusted_proxies": "***REMOVED SENSITIVE VALUE***",
        "redis": {
            "host": "***REMOVED SENSITIVE VALUE***",
            "port": 6379,
            "timeout": 1
        },
        "default_language": "de",
        "default_locale": "de_DE",
        "skeletondirectory": "",
        "default_phone_region": "de",
        "maintenance": false,
        "loglevel": 3,
        "enable_previews": false,
        "updater.release.channel": "stable",
        "upgrade.disable-web": true,
        "mail_smtpmode": "smtp",
        "mail_smtpsecure": "tls",
        "mail_sendmailmode": "smtp",
        "mail_from_address": "***REMOVED SENSITIVE VALUE***",
        "mail_domain": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpauthtype": "LOGIN",
        "mail_smtpauth": 1,
        "mail_smtphost": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpport": "587",
        "mail_smtpname": "***REMOVED SENSITIVE VALUE***",
        "mail_smtppassword": "***REMOVED SENSITIVE VALUE***",
        "twofactor_enforced": "false",
        "twofactor_enforced_groups": [
            "admin",
            "StoryEditor"
        ],
        "twofactor_enforced_excluded_groups": [],
        "app_install_overwrite": [
            "gpxmotion",
            "googledocsredirect",
            "admin_notifications",
            "dropit",
            "file_upload_notification",
            "flowupload",
            "integration_jira",
            "cfg_share_links",
            "apporder",
            "facerecognition",
            "folderplayer"
        ],
        "memories.exiftool": "\/config\/www\/nextcloud\/apps\/memories\/exiftool-bin\/exiftool-amd64-musl",
        "memories.vod.path": "\/config\/www\/nextcloud\/apps\/memories\/exiftool-bin\/go-vod-amd64",
        "memories.vod.ffmpeg": "\/usr\/bin\/ffmpeg",
        "memories.vod.ffprobe": "\/usr\/bin\/ffprobe"
    }
}
List of activated Apps
Enabled:
  - activity: 2.19.0
  - admin_audit: 1.17.0
  - announcementcenter: 6.6.2
  - apporder: 0.15.0
  - bruteforcesettings: 2.7.0
  - cfg_share_links: 4.1.0
  - cloud_federation_api: 1.10.0
  - comments: 1.17.0
  - dashboard: 7.7.0
  - dav: 1.27.0
  - deck: 1.11.0
  - external: 5.2.1
  - externalportal: 1.2.0
  - federatedfilesharing: 1.17.0
  - federation: 1.17.0
  - files: 1.22.0
  - files_external: 1.19.0
  - files_pdfviewer: 2.8.0
  - files_reminders: 1.0.0
  - files_rightclick: 1.6.0
  - files_sharing: 1.19.0
  - files_trashbin: 1.17.0
  - files_versions: 1.20.0
  - groupfolders: 15.3.1
  - impersonate: 1.14.0
  - integration_google: 2.0.2
  - integration_openai: 1.0.13
  - logreader: 2.12.0
  - lookup_server_connector: 1.15.0
  - memories: 5.4.1
  - nextcloud_announcements: 1.16.0
  - notes: 4.8.1
  - notifications: 2.15.0
  - notify_push: 0.6.3
  - oauth2: 1.15.1
  - onlyoffice: 8.2.0
  - password_policy: 1.17.0
  - polls: 5.3.2
  - previewgenerator: 5.3.0
  - privacy: 1.11.0
  - provisioning_api: 1.17.0
  - quota_warning: 1.17.0
  - recommendations: 1.6.0
  - related_resources: 1.2.0
  - serverinfo: 1.17.0
  - settings: 1.9.0
  - sharebymail: 1.17.0
  - socialsharing_email: 2.6.0
  - spreed: 17.1.1
  - support: 1.10.0
  - survey_client: 1.15.0
  - suspicious_login: 5.0.0
  - systemtags: 1.17.0
  - text: 3.8.0
  - theming: 2.2.0
  - twofactor_backupcodes: 1.16.0
  - twofactor_totp: 9.0.0
  - unsplash: 2.2.1
  - user_status: 1.7.0
  - viewer: 2.1.0
  - weather_status: 1.7.0
  - welcome: 1.0.10
  - workflowengine: 2.9.0
Disabled:
  - appointments: 1.15.3 (installed 1.15.3)
  - calendar: 4.5.0 (installed 4.5.0)
  - calendar_resource_management: 0.5.0 (installed 0.5.0)
  - circles: 27.0.1 (installed 26.0.0)
  - contacts: 5.4.0 (installed 5.4.0)
  - contactsinteraction: 1.8.0 (installed 1.6.0)
  - encryption: 2.15.0
  - facerecognition: 0.9.31 (installed 0.9.31)
  - file_upload_notification: 0.1.2 (installed 0.1.2)
  - files_downloadlimit: 1.1.0 (installed 1.1.0)
  - firstrunwizard: 2.16.0 (installed 2.15.0)
  - flowupload: 1.1.3 (installed 1.1.3)
  - googledocsredirect: 1.0.2 (installed 1.0.2)
  - holiday_calendars: 0.3.0 (installed 0.3.0)
  - imageconverter: 1.3.5 (installed 1.3.5)
  - mailnotifier: 0.0.3 (installed 0.0.3)
  - maps: 1.1.1 (installed 1.1.1)
  - photos: 2.3.0 (installed 2.2.0)
  - ransomware_protection: 1.14.0 (installed 1.14.0)
  - recognize: 4.3.2 (installed 4.3.2)
  - richdocuments: 8.2.0 (installed 8.2.0)
  - snowflakestheme: 1.1.0 (installed 1.1.0)
  - unroundedcorners: 1.1.1 (installed 1.1.1)
  - user_ldap: 1.17.0
  - user_saml: 5.2.2 (installed 5.2.2)
  - workflow_media_converter: 1.8.4 (installed 1.8.4)
Nextcloud Signing status
No errors have been found.
Nextcloud Logs
{"reqId":"cn2Eniltym4LJ2uF0lYM","level":3,"time":"2023-09-28T19:08:51+00:00","remoteAddr":"142.132.133.228","user":"Maxi","app":"webdav","method":"MOVE","url":"/remote.php/dav/files/Maxi/EKS/99_test","message":"Failed to rename /EKS/99_test to /EKS/99_TEST","userAgent":"Mozilla/5.0 (Windows) mirall/3.10.0stable-Win64 (build 20230915) (Nextcloud, windows-10.0.19045 ClientArchitecture: x86_64 OsArchitecture: x86_64)","version":"27.1.1.0","exception":{"Exception":"Sabre\\DAV\\Exception","Message":"Failed to rename /EKS/99_test to /EKS/99_TEST","Code":0,"Trace":[{"file":"/app/www/public/3rdparty/sabre/dav/lib/DAV/Tree.php","line":153,"function":"setName","class":"OCA\\DAV\\Connector\\Sabre\\Node","type":"->"},{"file":"/app/www/public/3rdparty/sabre/dav/lib/DAV/CorePlugin.php","line":612,"function":"move","class":"Sabre\\DAV\\Tree","type":"->"},{"file":"/app/www/public/3rdparty/sabre/event/lib/WildcardEmitterTrait.php","line":89,"function":"httpMove","class":"Sabre\\DAV\\CorePlugin","type":"->"},{"file":"/app/www/public/3rdparty/sabre/dav/lib/DAV/Server.php","line":472,"function":"emit","class":"Sabre\\DAV\\Server","type":"->"},{"file":"/app/www/public/3rdparty/sabre/dav/lib/DAV/Server.php","line":253,"function":"invokeMethod","class":"Sabre\\DAV\\Server","type":"->"},{"file":"/app/www/public/3rdparty/sabre/dav/lib/DAV/Server.php","line":321,"function":"start","class":"Sabre\\DAV\\Server","type":"->"},{"file":"/config/www/nextcloud/apps/dav/lib/Server.php","line":365,"function":"exec","class":"Sabre\\DAV\\Server","type":"->"},{"file":"/config/www/nextcloud/apps/dav/appinfo/v2/remote.php","line":35,"function":"exec","class":"OCA\\DAV\\Server","type":"->"},{"file":"/app/www/public/remote.php","line":172,"args":["/config/www/nextcloud/apps/dav/appinfo/v2/remote.php"],"function":"require_once"}],"File":"/config/www/nextcloud/apps/dav/lib/Connector/Sabre/Node.php","Line":160,"message":"Failed to rename /EKS/99_test to /EKS/99_TEST","exception":[],"CustomMessage":"Failed to rename /EKS/99_test to /EKS/99_TEST"},"id":"6515d19e0186b"}

{"reqId":"nC8yKmehn3h4W7i6skb6","level":3,"time":"2023-09-28T18:46:04+00:00","remoteAddr":"87.138.252.179","user":"ncadmin","app":"no app in context","method":"POST","url":"/ocs/v2.php/apps/files/api/v1/templates/create","message":"Could not create path \"/ncadmin/files/EKS/99_test/test.md\"","userAgent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:109.0) Gecko/20100101 Firefox/115.0","version":"27.1.1.0","exception":{"Exception":"OCP\\Files\\NotPermittedException","Message":"Could not create path \"/ncadmin/files/EKS/99_test/test.md\"","Code":0,"Trace":[{"file":"/app/www/public/lib/private/Files/Template/TemplateManager.php","line":162,"function":"newFile","class":"OC\\Files\\Node\\Folder","type":"->"},{"file":"/config/www/nextcloud/apps/files/lib/Controller/TemplateController.php","line":57,"function":"createFromTemplate","class":"OC\\Files\\Template\\TemplateManager","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/app/www/public/lib/private/AppFramework/Http/Dispatcher.php","line":230,"function":"create","class":"OCA\\Files\\Controller\\TemplateController","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/app/www/public/lib/private/AppFramework/Http/Dispatcher.php","line":137,"function":"executeController","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},{"file":"/app/www/public/lib/private/AppFramework/App.php","line":183,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},{"file":"/app/www/public/lib/private/Route/Router.php","line":315,"function":"main","class":"OC\\AppFramework\\App","type":"::"},{"file":"/app/www/public/ocs/v1.php","line":64,"function":"match","class":"OC\\Route\\Router","type":"->"},{"file":"/app/www/public/ocs/v2.php","line":23,"args":["/app/www/public/ocs/v1.php"],"function":"require_once"}],"File":"/app/www/public/lib/private/Files/Node/Folder.php","Line":193,"message":"Could not create path \"/ncadmin/files/EKS/99_test/test.md\"","exception":[],"CustomMessage":"Could not create path \"/ncadmin/files/EKS/99_test/test.md\""},"id":"6515d19e020df"}
Additional info

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with apps/dav/lib/Connector/Sabre/Node.php at line 160 and trace the WebDAV MOVE path through sabre/dav/lib/DAV/Tree.php. Reproduce a case-only rename on SMB storage and determine where the operation should be rejected before file operations occur. Done means the WebGUI and Nextcloud client consistently report the rename as invalid without leaving duplicate or dysfunctional folders.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
api, backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.