Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BadMethodCallException: path needs to be relative to the system wide data folder and point to a user specific file #29582

Closed
AndyXheli opened this issue Nov 6, 2021 · 4 comments
Labels
0. Needs triage Pending check for reproducibility or if it fits our roadmap bug feature: encryption (server-side)

Comments

@AndyXheli
Copy link

Steps to reproduce

  1. Create New User
  2. Have the user login for first time
  3. Delete User Account

Expected behaviour

Error should not appear

Actual behaviour

When deleted the user getting an error that can process the user dose gt deleted bafter refreshing the web page but getting error in the logs

Server configuration

Operating system:
Ubuntu 20.04
Web server:
Apache2
Database:
MariaDB 10.5.12
PHP version:
8.0
Nextcloud version: (see Nextcloud admin page)
NC 22.2.0
Updated from an older Nextcloud/ownCloud or fresh install:
NC 21
Where did you install Nextcloud from:

Are you using external storage, if yes which one: local/smb/sftp/...
No
Are you using encryption: yes/no
YES
Are you using an external user-backend, if yes which one: LDAP/ActiveDirectory/Webdav/...

Nextcloud log (data/nextcloud.log)

Nextcloud log
{"reqId":"R6dZFFlJW2RU9GPv8ch2","level":3,"time":"2021-11-06T14:18:40+00:00","remoteAddr":"10.241.202.18","user":"axheli","app":"no app in context","method":"DELETE","url":"/ocs/v2.php/cloud/users/test","message":"path needs to be relative to the system wide data folder and point to a user specific file","userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.69 Safari/537.36","version":"22.2.0.2","exception":{"Exception":"BadMethodCallException","Message":"path needs to be relative to the system wide data folder and point to a user specific file","Code":0,"Trace":[{"file":"/var/www/nextcloud/lib/private/Encryption/Keys/Storage.php","line":367,"function":"getUidAndFilename","class":"OC\\Encryption\\Util","type":"->"},{"file":"/var/www/nextcloud/lib/private/Encryption/Keys/Storage.php","line":189,"function":"getFileKeyDir","class":"OC\\Encryption\\Keys\\Storage","type":"->"},{"file":"/var/www/nextcloud/lib/private/Files/Storage/Wrapper/Encryption.php","line":315,"function":"deleteAllFileKeys","class":"OC\\Encryption\\Keys\\Storage","type":"->"},{"function":"rmdir","class":"OC\\Files\\Storage\\Wrapper\\Encryption","type":"->"},{"file":"/var/www/nextcloud/apps/files_trashbin/lib/Storage.php","line":193,"function":"call_user_func"},{"file":"/var/www/nextcloud/apps/files_trashbin/lib/Storage.php","line":125,"function":"doDelete","class":"OCA\\Files_Trashbin\\Storage","type":"->"},{"file":"/var/www/nextcloud/lib/private/Authentication/Listeners/UserDeletedFilesCleanupListener.php","line":72,"function":"rmdir","class":"OCA\\Files_Trashbin\\Storage","type":"->"},{"file":"/var/www/nextcloud/lib/private/EventDispatcher/ServiceEventListener.php","line":75,"function":"handle","class":"OC\\Authentication\\Listeners\\UserDeletedFilesCleanupListener","type":"->"},{"file":"/var/www/nextcloud/3rdparty/symfony/event-dispatcher/EventDispatcher.php","line":251,"function":"__invoke","class":"OC\\EventDispatcher\\ServiceEventListener","type":"->"},{"file":"/var/www/nextcloud/3rdparty/symfony/event-dispatcher/EventDispatcher.php","line":73,"function":"callListeners","class":"Symfony\\Component\\EventDispatcher\\EventDispatcher","type":"->"},{"file":"/var/www/nextcloud/lib/private/EventDispatcher/EventDispatcher.php","line":88,"function":"dispatch","class":"Symfony\\Component\\EventDispatcher\\EventDispatcher","type":"->"},{"file":"/var/www/nextcloud/lib/private/EventDispatcher/EventDispatcher.php","line":100,"function":"dispatch","class":"OC\\EventDispatcher\\EventDispatcher","type":"->"},{"file":"/var/www/nextcloud/lib/private/User/User.php","line":301,"function":"dispatchTyped","class":"OC\\EventDispatcher\\EventDispatcher","type":"->"},{"file":"/var/www/nextcloud/apps/provisioning_api/lib/Controller/UsersController.php","line":1001,"function":"delete","class":"OC\\User\\User","type":"->"},{"file":"/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php","line":217,"function":"deleteUser","class":"OCA\\Provisioning_API\\Controller\\UsersController","type":"->"},{"file":"/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php","line":126,"function":"executeController","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},{"file":"/var/www/nextcloud/lib/private/AppFramework/App.php","line":156,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},{"file":"/var/www/nextcloud/lib/private/Route/Router.php","line":301,"function":"main","class":"OC\\AppFramework\\App","type":"::"},{"file":"/var/www/nextcloud/ocs/v1.php","line":62,"function":"match","class":"OC\\Route\\Router","type":"->"},{"file":"/var/www/nextcloud/ocs/v2.php","line":23,"args":["/var/www/nextcloud/ocs/v1.php"],"function":"require_once"}],"File":"/var/www/nextcloud/lib/private/Encryption/Util.php","Line":233,"CustomMessage":"--"},"id":"6186903b2c352"}
@AndyXheli AndyXheli added 0. Needs triage Pending check for reproducibility or if it fits our roadmap bug labels Nov 6, 2021
@solracsf solracsf changed the title NC 22.2 BadMethodCallException: path needs to be relative to the system wide data folder and point to a user specific file BadMethodCallException: path needs to be relative to the system wide data folder and point to a user specific file Nov 6, 2021
@triopsi
Copy link

triopsi commented Jan 14, 2022

Same error here but over the Rest API.

curl -L -X DELETE 'https://example.com/ocs/v1.php/cloud/users/<userid>' \
-H 'OCS-APIRequest: true' \
-H 'Content-Type: application/x-www-form-urlencoded' \
-H 'Authorization: Basic ABC...'

Response:

<?xml version="1.0"?>
<ocs>
    <meta>
        <status>failure</status>
        <statuscode>998</statuscode>
        <message>Invalid query, please check the syntax. API specifications are here: http://www.freedesktop.org/wiki/Specifications/open-collaboration-services.
</message>
    </meta>
    <data/>
</ocs>

In the Syslog:


{"reqId":"FWUp3nvehRLr1JX9CoQn","level":3,"time":"2022-01-14T09:56:17+00:00","remoteAddr":"123.123.123.132","user":"admin","app":"no app in context","method":"DELETE","url":"/ocs/v1.php/cloud/users/<user_id>","message":"path needs to be relative to the system wide data folder and point to a user specific file","userAgent":"PostmanRuntime/7.28.4","version":"22.2.3.0","exception":{"Exception":"BadMethodCallException","Message":"path needs to be relative to the system wide data folder and point to a user specific file","Code":0,"Trace":[{"file":"/var/www/html/lib/private/Encryption/Keys/Storage.php","line":367,"function":"getUidAndFilename","class":"OC\\Encryption\\Util","type":"->"},{"file":"/var/www/html/lib/private/Encryption/Keys/Storage.php","line":189,"function":"getFileKeyDir","class":"OC\\Encryption\\Keys\\Storage","type":"->"},{"file":"/var/www/html/lib/private/Files/Storage/Wrapper/Encryption.php","line":315,"function":"deleteAllFileKeys","class":"OC\\Encryption\\Keys\\Storage","type":"->"},{"function":"rmdir","class":"OC\\Files\\Storage\\Wrapper\\Encryption","type":"->"},{"file":"/var/www/html/apps/files_trashbin/lib/Storage.php","line":193,"function":"call_user_func"},{"file":"/var/www/html/apps/files_trashbin/lib/Storage.php","line":125,"function":"doDelete","class":"OCA\\Files_Trashbin\\Storage","type":"->"},{"file":"/var/www/html/lib/private/Authentication/Listeners/UserDeletedFilesCleanupListener.php","line":72,"function":"rmdir","class":"OCA\\Files_Trashbin\\Storage","type":"->"},{"file":"/var/www/html/lib/private/EventDispatcher/ServiceEventListener.php","line":75,"function":"handle","class":"OC\\Authentication\\Listeners\\UserDeletedFilesCleanupListener","type":"->"},{"file":"/var/www/html/3rdparty/symfony/event-dispatcher/EventDispatcher.php","line":251,"function":"__invoke","class":"OC\\EventDispatcher\\ServiceEventListener","type":"->"},{"file":"/var/www/html/3rdparty/symfony/event-dispatcher/EventDispatcher.php","line":73,"function":"callListeners","class":"Symfony\\Component\\EventDispatcher\\EventDispatcher","type":"->"},{"file":"/var/www/html/lib/private/EventDispatcher/EventDispatcher.php","line":88,"function":"dispatch","class":"Symfony\\Component\\EventDispatcher\\EventDispatcher","type":"->"},{"file":"/var/www/html/lib/private/EventDispatcher/EventDispatcher.php","line":100,"function":"dispatch","class":"OC\\EventDispatcher\\EventDispatcher","type":"->"},{"file":"/var/www/html/lib/private/User/User.php","line":301,"function":"dispatchTyped","class":"OC\\EventDispatcher\\EventDispatcher","type":"->"},{"file":"/var/www/html/apps/provisioning_api/lib/Controller/UsersController.php","line":1001,"function":"delete","class":"OC\\User\\User","type":"->"},{"file":"/var/www/html/lib/private/AppFramework/Http/Dispatcher.php","line":217,"function":"deleteUser","class":"OCA\\Provisioning_API\\Controller\\UsersController","type":"->"},{"file":"/var/www/html/lib/private/AppFramework/Http/Dispatcher.php","line":126,"function":"executeController","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},{"file":"/var/www/html/lib/private/AppFramework/App.php","line":156,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},{"file":"/var/www/html/lib/private/Route/Router.php","line":302,"function":"main","class":"OC\\AppFramework\\App","type":"::"},{"file":"/var/www/html/ocs/v1.php","line":62,"function":"match","class":"OC\\Route\\Router","type":"->"}],"File":"/var/www/html/lib/private/Encryption/Util.php","Line":233,"CustomMessage":"--"},"id":"61e148dd91803"}

@gmaxbass
Copy link

gmaxbass commented Feb 24, 2022

Same problem on 22.2.5 docker image using occ user:delete

docker exec -ti --user www-data cleantest01-nc php /var/www/html/occ user:delete luke.skywalker

In Util.php line 233:

path needs to be relative to the system wide data folder and point to a user specific file

user:delete

However this seems to be only a wrong error since user is deleted.
Is there any fix/workaround for this?

@Niveshkrishna
Copy link

Same error to me as well when using drop_account app. User is deleted but this exception is thrown

https://framagit.org/framasoft/nextcloud/drop_account

@Pytal
Copy link
Member

Pytal commented May 17, 2022

Fixed in #32357

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0. Needs triage Pending check for reproducibility or if it fits our roadmap bug feature: encryption (server-side)
Projects
None yet
Development

No branches or pull requests

7 participants