[Bug]: records in "oc_mounts" are not generated correctly / are cleared for particular users
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 a user shares a file or a folder between users on the same cloud, the file is not displayed to the other person. Also shares created with talk or with the "external_storage" provider are affected with this bug.
This does only apply for specific users and when the shared file / folder is not located at the users root directory. Within the "shared" file view all the shares are displayed correctly (but cannot be opened because the file could not be found).
Steps to reproduce
- Add
'share_folder' => '/Shared'to the configuration file (or share a file with talk so that the file / folder is not placed at the root) - Share a file to another user
- Open the
/Sharedfolder - The folder is empty
After that, the oc_mounts table only contains a single record for the affected user:
| id | storage_id | root_id | user_id | mount_point | mount_id | mount_provider_class
-----------------------------------------------------------------------------------------------------------------------
| 2 | 3 | 1022 | affectedUser | /affectedUser / | NULL | OC\Files\Mount\LocalHomeMountProvider |
But the shared file is listed in oc_share correctly.
| id | share_type | share_with | password | uid_owner | uid_initiator | parent | item_type | item_source | item_target | file_source | file_target | permissions | stime | accepted | expiration | token | mail_send | share_name | password_by_talk | note | hide_download | label | password_expiration_time | attributes |
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
| 344 | 0 | affectedUser | NULL | admin | admin | NULL | file | 596402 | NULL | 596402 | /Shared/file.txt | 19 | 1694203487 | 1 | 2023-11-07 00:00:00 | NULL | 0 | NULL | 0 | NULL | 0 | NULL | NULL | NULL |
In some cases (~10% of the tries → reload the page until it works) the file is displayed correctly, and the required record was inserted into oc_mounts. But with the next reload of the page / when trying to open the file, the table is cleared again and the file won't be displayed / cannot be opened anymore.
The missing records for the oc_mounts table can be determined with the following select.
SELECT
(select numeric_id FROM oc_storages ss WHERE ss.id = CONCAT('home::', s.uid_owner)),
s.file_source,
s.share_with,
CONCAT('/', s.share_with, '/files', s.file_target, '/'),
'OCA\\Files_Sharing\\MountProvider'
FROM oc_share s
LEFT JOIN oc_mounts m
ON m.root_id = s.file_source
AND m.user_id = s.share_with
WHERE m.id IS NULL
AND s.share_with = 'affectedUser';
Expected behavior
The file or folder is visible within /Shared and can be opened.
Also, a record should be inserted into oc_mounts:
| 4557585 | 2 | 596402 | affectedUser | /affectedUser/files/Shared/file.txt/ | OCA\Files_Sharing\MountProvider |
Installation method
Community Manual installation with Archive
Nextcloud Server version
27
Operating system
Debian/Ubuntu
PHP engine version
PHP 8.1
Web server
Apache (supported)
Database engine version
MariaDB
Is this bug present after an update or on a fresh install?
Upgraded to a MAJOR version (ex. 22 to 23)
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": {
"instanceid": "***REMOVED SENSITIVE VALUE***",
"passwordsalt": "***REMOVED SENSITIVE VALUE***",
"secret": "***REMOVED SENSITIVE VALUE***",
"share_folder": "\/Shared",
"trusted_domains": [
"xxx.de",
"xxx.de"
],
"trusted_proxies": "***REMOVED SENSITIVE VALUE***",
"allow_local_remote_servers": true,
"datadirectory": "***REMOVED SENSITIVE VALUE***",
"dbtype": "mysql",
"version": "27.0.1.2",
"overwrite.cli.url": "https:\/\/xxx.de",
"overwriteprotocol": "https",
"dbname": "***REMOVED SENSITIVE VALUE***",
"dbhost": "***REMOVED SENSITIVE VALUE***",
"dbport": "",
"dbtableprefix": "oc_",
"mysql.utf8mb4": true,
"dbuser": "***REMOVED SENSITIVE VALUE***",
"dbpassword": "***REMOVED SENSITIVE VALUE***",
"installed": true,
"htaccess.RewriteBase": "\/",
"memcache.local": "\\OC\\Memcache\\APCu",
"app_install_overwrite": [
"cookbook",
"drawio",
"gpxedit",
"ocr",
"weather",
"files_retention",
"emlviewer",
"rainloop",
"pdfdraw",
"camerarawpreviews",
"pdfannotate",
"gpxmotion",
"epubreader",
"integration_whiteboard",
"talk_matterbridge",
"workflow_media_converter",
"extract",
"breezedark",
"video_converter",
"music",
"metadata",
"facerecognition",
"sharerenamer"
],
"mail_smtpmode": "smtp",
"mail_smtpsecure": "ssl",
"mail_sendmailmode": "smtp",
"mail_from_address": "***REMOVED SENSITIVE VALUE***",
"mail_domain": "***REMOVED SENSITIVE VALUE***",
"mail_smtpauth": 1,
"mail_smtphost": "***REMOVED SENSITIVE VALUE***",
"mail_smtpport": "465",
"mail_smtpname": "***REMOVED SENSITIVE VALUE***",
"mail_smtppassword": "***REMOVED SENSITIVE VALUE***",
"maintenance": false,
"updater.release.channel": "stable",
"theme": "",
"loglevel": 0,
"log.condition": {
"apps": [
"admin_audit"
]
},
"default_phone_region": "DE",
"filelocking.enabled": "true",
"memcache.locking": "\\OC\\Memcache\\Redis",
"redis": {
"host": "***REMOVED SENSITIVE VALUE***",
"port": 0,
"timeout": 0
},
"mail_smtpauthtype": "LOGIN",
"tempdirectory": "\/media\/nextcloudtemp",
"enforce_theme": "breezedark",
"memories.exiftool": "\/var\/www\/nextcloud\/apps\/memories\/exiftool-bin\/exiftool-amd64-glibc",
"enabledPreviewProviders": [
"OC\\Preview\\Image",
"OC\\Preview\\HEIC",
"OC\\Preview\\TIFF",
"OC\\Preview\\Movie",
"OC\\Preview\\MKV",
"OC\\Preview\\MP4",
"OC\\Preview\\AVI"
],
"memories.vod.path": "\/var\/www\/nextcloud\/apps\/memories\/exiftool-bin\/go-vod-amd64",
"memories.vod.ffmpeg": "\/usr\/bin\/ffmpeg",
"memories.vod.ffprobe": "\/usr\/bin\/ffprobe",
"memories.gis_type": 1,
"memories.vod.disable": false,
"memories.video_default_quality": "-2"
}
}
List of activated Apps
Enabled:
- activity: 2.19.0
- analytics: 4.9.4
- bookmarks: 13.0.1
- breezedark: 26.0.0
- bruteforcesettings: 2.7.0
- calendar: 4.4.3
- camerarawpreviews: 0.8.2
- circles: 27.0.1
- cloud_federation_api: 1.10.0
- comments: 1.17.0
- contacts: 5.3.2
- contactsinteraction: 1.8.0
- cookbook: 0.10.2
- dashboard: 7.7.0
- dav: 1.27.0
- deck: 1.10.0
- drawio: 2.1.2
- emlviewer: 1.0.7
- event_update_notification: 2.2.0
- external: 5.2.0
- extract: 1.3.6
- facerecognition: 0.9.20
- federatedfilesharing: 1.17.0
- federation: 1.17.0
- files: 1.22.0
- files_external: 1.19.0
- files_pdfviewer: 2.8.0
- files_retention: 1.16.0
- files_rightclick: 1.6.0
- files_sharing: 1.19.0
- files_trashbin: 1.17.0
- files_versions: 1.20.0
- files_zip: 1.4.0
- firstrunwizard: 2.16.0
- forms: 3.3.1
- gpxedit: 0.0.14
- gpxmotion: 0.1.0
- gpxpod: 5.0.12
- integration_giphy: 1.0.7
- integration_openstreetmap: 1.0.6
- logreader: 2.12.0
- lookup_server_connector: 1.15.0
- mail: 3.3.1
- memories: 5.2.1
- metadata: 0.19.0
- music: 1.8.4
- notes: 4.8.1
- notifications: 2.15.0
- notify_push: 0.6.3
- oauth2: 1.15.1
- onlyoffice: 8.1.0
- password_policy: 1.17.0
- pdfannotate: 0.0.10
- phonetrack: 0.7.6
- photos: 2.3.0
- polls: 5.2.0
- previewgenerator: 5.3.0
- privacy: 1.11.0
- provisioning_api: 1.17.0
- recognize: 4.3.0
- recommendations: 1.6.0
- related_resources: 1.2.0
- serverinfo: 1.17.0
- settings: 1.9.0
- sharebymail: 1.17.0
- side_menu: 3.10.2
- spreed: 17.0.2
- support: 1.10.0
- survey_client: 1.15.0
- suspicious_login: 5.0.0
- systemtags: 1.17.0
- talk_matterbridge: 1.26.0-0
- tasks: 0.15.0
- text: 3.8.0
- theming: 2.2.0
- theming_customcss: 1.14.0
- twofactor_backupcodes: 1.16.0
- updatenotification: 1.17.0
- user_status: 1.7.0
- viewer: 2.1.0
- weather: 1.7.7
- weather_status: 1.7.0
- workflowengine: 2.9.0
Disabled:
- admin_audit: 1.17.0
- encryption: 2.15.0
- epubreader: 1.4.7 (installed 1.4.7)
- integration_whiteboard: 0.0.15 (installed 0.0.15)
- nextcloud_announcements: 1.16.0 (installed 1.9.0)
- ocr: 6.0.58 (installed 6.0.58)
- rainloop: 7.2.6 (installed 7.2.6)
- twofactor_totp: 9.0.0
- user_ldap: 1.17.0
- video_converter: 1.0.6 (installed 1.0.6)
- workflow_media_converter: 1.8.4 (installed 1.8.4)
- workflow_ocr: 1.27.0 (installed 1.27.0)
Nextcloud Signing status
No response
Nextcloud Logs
When the file was displayed within your 10% chance, opened via the "shared" panel or within Talk:
{"reqId":"Vnm6Lz7YRPkMaQp4Uzzb","level":0,"time":"2023-09-08T20:13:45+00:00","remoteAddr":"192.168.1.15","user":"affectedUser","app":"webdav","method":"PROPFIND","url":"/remote.php/dav/files/affectedUser/Sonstige%20Dateien/Apps/Talk/2022-11-27%2013-28-15.jpg","message":"File with name /Sonstige Dateien/Apps/Talk/2022-11-27 13-28-15.jpg could not be located","userAgent":"Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/109.0","version":"27.0.1.2","exception":{"Exception":"Sabre\\DAV\\Exception\\NotFound","Message":"File with name /Sonstige Dateien/Apps/Talk/2022-11-27 13-28-15.jpg could not be located","Code":0,"Trace":[{"file":"/var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Tree.php","line":78,"function":"getChild","class":"OCA\\DAV\\Connector\\Sabre\\Directory","type":"->"},{"file":"/var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php","line":971,"function":"getNodeForPath","class":"Sabre\\DAV\\Tree","type":"->"},{"file":"/var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php","line":1662,"function":"getPropertiesIteratorForPath","class":"Sabre\\DAV\\Server","type":"->"},{"file":"/var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php","line":1647,"function":"writeMultiStatus","class":"Sabre\\DAV\\Server","type":"->"},{"file":"/var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/CorePlugin.php","line":346,"function":"generateMultiStatus","class":"Sabre\\DAV\\Server","type":"->"},{"file":"/var/www/nextcloud/3rdparty/sabre/event/lib/WildcardEmitterTrait.php","line":89,"function":"httpPropFind","class":"Sabre\\DAV\\CorePlugin","type":"->"},{"file":"/var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php","line":472,"function":"emit","class":"Sabre\\DAV\\Server","type":"->"},{"file":"/var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php","line":253,"function":"invokeMethod","class":"Sabre\\DAV\\Server","type":"->"},{"file":"/var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php","line":321,"function":"start","class":"Sabre\\DAV\\Server","type":"->"},{"file":"/var/www/nextcloud/apps/dav/lib/Server.php","line":364,"function":"exec","class":"Sabre\\DAV\\Server","type":"->"},{"file":"/var/www/nextcloud/apps/dav/appinfo/v2/remote.php","line":35,"function":"exec","class":"OCA\\DAV\\Server","type":"->"},{"file":"/var/www/nextcloud/remote.php","line":172,"args":["/var/www/nextcloud/apps/dav/appinfo/v2/remote.php"],"function":"require_once"}],"File":"/var/www/nextcloud/apps/dav/lib/Connector/Sabre/Directory.php","Line":227,"message":"File with name /Sonstige Dateien/Apps/Talk/2022-11-27 13-28-15.jpg could not be located","exception":{},"CustomMessage":"File with name /Sonstige Dateien/Apps/Talk/2022-11-27 13-28-15.jpg could not be located"}}
Additional info
No response
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 missing or cleared records using the share_folder setting and inspect the oc_mounts and oc_share queries shown in the report. Trace the affected shared-file paths through the WebDAV, Talk, and external_storage entry points; done means the expected mount record persists and the shared file or folder opens from /Shared.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- mariadb, php
- Domain
- backend, databases
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100