[Bug]: Empty Files (0 Bytes) on SMB/CIFS External Storage Are Unmanageable: Cannot Open, Edit, or Delete
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 36.9k
- Forks
- 5.2k
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 713
Description
⚠️ This issue respects the following points: ⚠️
- This is a bug, not a question or a configuration/webserver/proxy issue.
- This issue is not already reported on Github OR Nextcloud Community Forum (I've searched it).
- Nextcloud Server is up to date. See Maintenance and Release Schedule for supported versions.
- I agree to follow Nextcloud's Code of Conduct.
Bug description
When creating or accessing empty files (0 bytes) on SMB/CIFS external storage, Nextcloud fails to open or delete these files. The files become inaccessible - they are visible in the file list but cannot be opened, edited, or deleted through the Nextcloud interface. This affects all file types (.md, .txt, etc.) when they are empty (while creating).
Workaround
Add minimal content to the file on the SMB server (e.g., add one character via nano text editor). After adding content, the file becomes fully functional in Nextcloud - can be opened, edited, saved, and deleted.
Environment
Nextcloud Version: Nextcloud Hub 9 (32.0.6)
(known since Version 30 and exists maybe before also)
Storage Type: SMB/CIFS via "External Storage 1.24.1"
Affected Files: All file types when 0 bytes in size
Steps to reproduce
1.Steps to Reproduce
Method A: Create via Nextcloud
-
Set up an SMB/CIFS external storage in Nextcloud -
In Nextcloud Files, navigate to the external storage -
Click "New" → "New text file" and create any file (e.g., .md) -
The editor opens but fails to load the file (times out after a while) -
After closing the editor, the file (showing 0B) cannot be deleted from Nextcloud
Method B: Create directly on SMB server
-
Create an empty file directly on the SMB server (e.g., touch test.md or touch test.txt) -
Try to open or delete the file in Nextcloud Web interface → Fails
Expected behavior
Expected Behavior
-
Empty files should be accessible, editable, and deletable regardless of file type -
File operations should work regardless of file size or content
Actual Behavior
-
Empty files (0 bytes) are completely unmanageable in Nextcloud -
Files with content (>0 bytes) work without issues -
Affects all file types when they are empty
Nextcloud Server version
30
Operating system
Debian/Ubuntu
PHP engine version
PHP 8.2
Web server
Apache (supported)
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": {
"passwordsalt": "***REMOVED SENSITIVE VALUE***",
"secret": "***REMOVED SENSITIVE VALUE***",
"trusted_domains": [
"localhost",
"fileshare.bggroteradler.de",
"nxtcl.bgg.internal",
"nxtcl1.bgg.internal",
"192.168.216.7"
],
"datadirectory": "***REMOVED SENSITIVE VALUE***",
"dbtype": "mysql",
"version": "30.0.16.1",
"overwrite.cli.url": "http:\/\/localhost",
"dbname": "***REMOVED SENSITIVE VALUE***",
"dbhost": "***REMOVED SENSITIVE VALUE***",
"dbport": "",
"dbtableprefix": "oc_",
"mysql.utf8mb4": true,
"dbuser": "***REMOVED SENSITIVE VALUE***",
"dbpassword": "***REMOVED SENSITIVE VALUE***",
"installed": true,
"instanceid": "***REMOVED SENSITIVE VALUE***",
"memcache.local": "\\OC\\Memcache\\Redis",
"redis": {
"host": "***REMOVED SENSITIVE VALUE***",
"port": 0,
"timeout": 0
},
"filelocking.enabled": true,
"memcache.locking": "\\OC\\Memcache\\Redis",
"log_type": "file",
"logfile": "\/var\/www\/nextcloud-data\/nextcloud.log",
"loglevel": 4,
"trusted_proxies": "***REMOVED SENSITIVE VALUE***",
"skeletondirectory": "",
"defaultapp": "files",
"mail_smtpmode": "smtp",
"mail_smtphost": "***REMOVED SENSITIVE VALUE***",
"mail_sendmailmode": "pipe",
"mail_smtpport": "465",
"mail_from_address": "***REMOVED SENSITIVE VALUE***",
"mail_domain": "***REMOVED SENSITIVE VALUE***",
"ldapIgnoreTLSValidation": true,
"updater.secret": "***REMOVED SENSITIVE VALUE***",
"maintenance": false,
"theme": "",
"ldapProviderFactory": "OCA\\User_LDAP\\LDAPProviderFactory",
"forbidden_filename_basenames": [
"con",
"prn",
"aux",
"nul",
"com0",
"com1",
"com2",
"com3",
"com4",
"com5",
"com6",
"com7",
"com8",
"com9",
"com\u00b9",
"com\u00b2",
"com\u00b3",
"lpt0",
"lpt1",
"lpt2",
"lpt3",
"lpt4",
"lpt5",
"lpt6",
"lpt7",
"lpt8",
"lpt9",
"lpt\u00b9",
"lpt\u00b2",
"lpt\u00b3"
],
"forbidden_filename_characters": [
"<",
">",
":",
"\"",
"|",
"?",
"*",
"\\",
"\/"
],
"forbidden_filename_extensions": [
" ",
".",
".filepart",
".part"
],
"default_phone_region": "DE",
"maintenance_window_start": 2,
"mail_smtpsecure": "ssl",
"data-fingerprint": "dba5f96124d9655767820a9739595e6d"
}
}
List of activated Apps
Enabled:
- activity: 3.0.0
- app_api: 4.0.6
- bruteforcesettings: 3.0.0
- circles: 30.0.0
- cloud_federation_api: 1.13.0
- comments: 1.20.1
- dav: 1.31.1
- deck: 1.14.6
- documentserver_community: 0.2.0
- federatedfilesharing: 1.20.0
- files: 2.2.0
- files_downloadlimit: 3.0.0
- files_external: 1.22.0
- files_pdfviewer: 3.0.0
- files_reminders: 1.3.0
- files_sharing: 1.22.0
- files_trashbin: 1.20.1
- files_versions: 1.23.0
- groupfolders: 18.1.8
- keeweb: 0.6.22
- logcleaner: 1.1.8
- logreader: 3.0.0
- lookup_server_connector: 1.18.0
- maps: 1.6.0
- metadata: 0.23.0
- notes: 4.12.3
- notifications: 3.0.0
- oauth2: 1.18.1
- onlyoffice: 9.11.0
- ownershiptransfer: 1.2.1
- password_policy: 2.0.0
- passwords: 2025.10.10
- passwords_handbook: 2025.10.20
- photos: 3.0.2
- privacy: 2.0.0
- provisioning_api: 1.20.0
- serverinfo: 2.0.0
- settings: 1.13.0
- spreed: 20.1.10
- support: 2.0.0
- survey_client: 2.0.0
- systemtags: 1.20.0
- text: 4.1.0
- theming: 2.6.0
- twofactor_backupcodes: 1.19.0
- unroundedcorners: 1.1.5
- updatenotification: 1.20.0
- user_ldap: 1.21.0
- user_status: 1.10.0
- viewer: 3.0.0
- webhook_listeners: 1.1.0-dev
- workflowengine: 2.12.0
Disabled:
- admin_audit: 1.20.0
- contactsinteraction: 1.11.0 (installed 1.10.0)
- dashboard: 7.10.0 (installed 7.9.0)
- encryption: 2.18.0
- federation: 1.20.0 (installed 1.19.0)
- firstrunwizard: 3.0.0 (installed 2.18.0)
- integration_dropbox: 4.0.3 (installed 4.0.3)
- nextcloud_announcements: 2.0.0 (installed 1.18.0)
- openotp_sign: 1.30.1 (installed 1.30.1)
- recommendations: 3.0.0 (installed 2.1.0)
- related_resources: 1.5.0 (installed 1.4.0)
- sharebymail: 1.20.0 (installed 1.19.0)
- suspicious_login: 8.0.0
- twofactor_nextcloud_notification: 4.0.0
- twofactor_totp: 12.0.0-dev
- weather_status: 1.10.0 (installed 1.9.0)
Nextcloud Signing status
No errors have been found.
Nextcloud Logs
This is an older Message:
{"reqId":"gS9Z4EsONWFsmHDC6mPx","level":3,"time":"2024-07-26T07:35:01+00:00","remoteAddr":"","user":"admin","app":"PHP","method":"","url":"--","message":"fopen(/var/www/nextcloud/config/config.php): Failed to open stream: No such file or directory at /var/www/nextcloud/lib/private/Config.php#221","userAgent":"--","version":"29.0.4.1","data":{"app":"PHP"}}
Additional info
Additional Context
local storage not affected
File operations work normally once any content is added to the file
This appears to be a general file handling bug for empty files on external SMB storage
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the issue through the Nextcloud Files interface with an empty file on SMB/CIFS external storage, using both creation methods described. Compare opening and deleting 0-byte files with files containing one character. Done means empty files can be opened, edited, and deleted through Nextcloud, while local storage and non-empty files continue to work.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100