nextcloud / server

ā˜ļø Nextcloud server, a safe home for all your data
https://nextcloud.com
GNU Affero General Public License v3.0
27.46k stars 4.08k forks source link

Call to a member function getUID() when trying to delete or rename on Public Share #20388

Closed majesty54 closed 3 years ago

majesty54 commented 4 years ago

How to use GitHub

Steps to reproduce

  1. Share a folder as Public with upload permissions
  2. Open the link
  3. try to delete a file

Expected behaviour

File should be deleted/renamed

Actual behaviour

impossible to delete or rename: Error | public | Error:Ā Call to a member function getUID() on null

Server configuration

Operating system: Linux NEXTCLOUD 4.19.0-5-amd64 #1 SMP Debian 4.19.37-5+deb10u2 (2019-08-08) x86_64 GNU/Linux Web server: Apache2 Database: 10.3.22-MariaDB-0 PHP version: PHP 7.3.14-1~deb10u1 Nextcloud version: (see Nextcloud admin page) 18.0.3 Updated from an older Nextcloud/ownCloud or fresh install: Updated from 17 Where did you install Nextcloud from:

Signing status:

Signing status No errors have been found.

List of activated apps:

App list - admin_audit: 1.8.0 - bruteforcesettings: 1.6.0 - circles: 0.18.4 - cloud_federation_api: 1.1.0 - comments: 1.8.0 - dav: 1.14.0 - federatedfilesharing: 1.8.0 - federation: 1.8.0 - files: 1.13.1 - files_external: 1.9.0 - files_pdfviewer: 1.7.0 - files_rightclick: 0.15.2 - files_sharing: 1.10.1 - files_trashbin: 1.8.0 - files_versions: 1.11.0 - files_videoplayer: 1.7.0 - logreader: 2.3.0 - lookup_server_connector: 1.6.0 - nextcloud_announcements: 1.7.0 - notifications: 2.6.0 - oauth2: 1.6.0 - password_policy: 1.8.0 - photos: 1.0.0 - polls: 1.3.0 - privacy: 1.2.0 - provisioning_api: 1.8.0 - ransomware_protection: 1.6.1 - recommendations: 0.6.0 - richdocuments: 3.5.3 - serverinfo: 1.8.0 - settings: 1.0.0 - sharebymail: 1.8.0 - support: 1.1.0 - survey_client: 1.6.0 - systemtags: 1.8.0 - text: 2.0.0 - theming: 1.9.0 - twofactor_backupcodes: 1.7.0 - updatenotification: 1.8.0 - user_ldap: 1.8.0 - viewer: 1.2.0 - workflowengine: 2.0.0 Disabled: - accessibility - activity - admin_notifications - announcementcenter - documentserver_community - drawio - encryption - files_accesscontrol - files_trackdownloads - firstrunwizard - keeweb - mindmaps - ownbackup - sharelisting - spreed - user_saml - w2g2

Nextcloud configuration:

Config report $CONFIG = array ( 'instanceid' => '************', 'passwordsalt' => '*********', 'secret' => '*************', 'trusted_domains' => array ( 0 => '************', ), 'datadirectory' => '/var/www/nextcloud/data', 'overwrite.cli.url' => 'https://************', 'overwriteprotocol' => 'https', 'dbtype' => 'mysql', 'version' => '18.0.3.0', 'dbname' => 'nextcloud', 'dbhost' => 'localhost', 'dbport' => '', 'dbtableprefix' => 'oc_', 'dbuser' => '*******', 'dbpassword' => '*****', 'installed' => true, 'ldapIgnoreNamingRules' => false, 'ldapProviderFactory' => '\\OCA\\User_LDAP\\LDAPProviderFactory', 'maintenance' => false, 'default_language' => 'fr_FR', 'mail_from_address' => 'noreply', 'mail_domain' => '**', 'mail_smtpsecure' => 'tls', 'mail_smtphost' => '****', 'mail_smtpport' => '****', 'mail_smtpauthtype' => '****', 'mail_smtpname' => '***', 'mail_smtppassword' => '****', 'skeletondirectory' => '', 'theme' => '', 'loglevel' => 0, 'updater.release.channel' => 'stable', 'memcache.local' => '\\OC\\Memcache\\Redis', 'memcache.locking' => '\\OC\\Memcache\\Redis', 'filelocking.enabled' => 'true', 'redis' => array ( 'host' => '/var/run/redis/redis.sock', 'port' => 0, 'timeout' => 0.0, ), 'app_install_overwrite' => 0 => 'circles', ), 'mysql.utf8mb4' => true, 'mail_smtpmode' => 'smtp', 'mail_smtpauth' => 1, );

Are you using external storage, if yes which one: smb

Are you using encryption: no

Are you using an external user-backend, if yes which one: ActiveDirectory

LDAP configuration (delete this part if not used)

LDAP config

Client configuration

Browser: Firefox latest Operating system: Windows 10

Logs

Web server error log

Web server error log

Nextcloud log (data/nextcloud.log)

Nextcloud log Error | public | Error: Call to a member function getUID() on null/var/www/nextcloud/lib/private/Files/Filesystem.php - line 907: OC\Files\View->getOwner("/MesDocumen ... s")/var/www/nextcloud/apps/files_trashbin/lib/Trashbin.php - line 91: OC\Files\Filesystem::getOwner("/MesDocumen ... s")/var/www/nextcloud/apps/files_trashbin/lib/Trashbin.php - line 76: OCA\Files_Trashbin\Trashbin::getUidAndFilename("/MesDocumen ... s")/var/www/nextcloud/lib/private/legacy/hook.php - line 111: OCA\Files_Trashbin\Trashbin::ensureFileScannedHook({ run: true, ... "})/var/www/nextcloud/lib/private/Files/View.php - line 1275: OC_Hook::emit("OC_Filesystem", "delete", { run: true, ... "})/var/www/nextcloud/lib/private/Files/View.php - line 1145: OC\Files\View->runHooks([ "delete"], "/MesDocumen ... s")/var/www/nextcloud/lib/private/Files/View.php - line 716: OC\Files\View->basicOperation("unlink", "/sdgsdg.ods", [ "delete"])/var/www/nextcloud/apps/dav/lib/Connector/Sabre/File.php - line 448: OC\Files\View->unlink("/sdgsdg.ods")/var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Tree.php - line 179: OCA\DAV\Connector\Sabre\File->delete()/var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/CorePlugin.php - line 287: Sabre\DAV\Tree->delete("sdgsdg.ods")<>Sabre\DAV\CorePlugin->httpDelete(Sabre\HTTP\R ... "}, Sabre\HTTP\Response {})/var/www/nextcloud/3rdparty/sabre/event/lib/EventEmitterTrait.php - line 105: call_user_func_array([ Sabre\DAV\ ... "], [ Sabre\HTTP ... }])/var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php - line 479: Sabre\Event\EventEmitter->emit("method:DELETE", [ Sabre\HTTP ... }])/var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php - line 254: Sabre\DAV\Server->invokeMethod(Sabre\HTTP\R ... "}, Sabre\HTTP\Response {})/var/www/nextcloud/apps/dav/appinfo/v1/publicwebdav.php - line 109: Sabre\DAV\Server->exec()/var/www/nextcloud/public.php - line 81: require_once("/var/www/ne ... p")

Browser log

Browser log ``` Insert your browser log here, this could for example include: a) The javascript console log b) The network log c) ... ```
krocheck commented 4 years ago

We are seeing this on public uploads: (v18.0.3)

[public] Error: Error: Call to a member function getUID() on null at <<closure>>

 0. /var/www/html/apps/activity/lib/FilesHooks.php line 638
    OC\Files\View->getOwner("/Clients/ ... f")
 1. /var/www/html/apps/activity/lib/FilesHooks.php line 190
    OCA\Activity\FilesHooks->getSourcePathAndOwner("/Clients/ ... f")
 2. /var/www/html/apps/activity/lib/FilesHooks.php line 148
    OCA\Activity\FilesHooks->addNotificationsForFileAction("/Clients/ ... f", "file_created", "", "created_public")
 3. /var/www/html/apps/activity/lib/FilesHooksStatic.php line 47
    OCA\Activity\FilesHooks->fileCreate("/Clients/ ... f")
 4. /var/www/html/lib/private/legacy/hook.php line 111
    OCA\Activity\FilesHooksStatic::fileCreate({path: "/Clients ... "})
 5. /var/www/html/apps/dav/lib/Connector/Sabre/File.php line 389
    OC_Hook::emit("OC_Filesystem", "post_create", {path: "/Clients ... "})
 6. /var/www/html/apps/dav/lib/Connector/Sabre/File.php line 321
    OCA\DAV\Connector\Sabre\File->emitPostHooks(false)
 7. /var/www/html/apps/dav/lib/Connector/Sabre/Directory.php line 156
    OCA\DAV\Connector\Sabre\File->put(null)
 8. /var/www/html/3rdparty/sabre/dav/lib/DAV/Server.php line 1096
    OCA\DAV\Connector\Sabre\Directory->createFile("marquette-map.pdf", null)
 9. /var/www/html/3rdparty/sabre/dav/lib/DAV/CorePlugin.php line 525
    Sabre\DAV\Server->createFile("marquette-map.pdf", null, null)
10. <<closure>>
    Sabre\DAV\CorePlugin->httpPut(Sabre\HTTP\Reque ... "}, Sabre\HTTP\Response {})
11. /var/www/html/3rdparty/sabre/event/lib/EventEmitterTrait.php line 105
    call_user_func_array([Sabre\DAV\CorePlugin {},"httpPut"], [Sabre\HTTP\Requ ... }])
12. /var/www/html/3rdparty/sabre/dav/lib/DAV/Server.php line 479
    Sabre\Event\EventEmitter->emit("method:PUT", [Sabre\HTTP\Requ ... }])
13. /var/www/html/3rdparty/sabre/dav/lib/DAV/Server.php line 254
    Sabre\DAV\Server->invokeMethod(Sabre\HTTP\Reque ... "}, Sabre\HTTP\Response {})
14. /var/www/html/apps/dav/appinfo/v1/publicwebdav.php line 109
    Sabre\DAV\Server->exec()
15. /var/www/html/public.php line 81
    require_once("/var/www/html/a ... p")

PUT /public.php/webdav/marquette-map.pdf
from xxx.xxx.xxx.xxx at 2020-04-10T16:24:35+00:00

Results in "An unknown error has occurred" popup in the upper-right. image But a refresh shows the file was uploaded correctly. Getting reports from clients they are having issues, but of course we are still getting the files.

massa007 commented 4 years ago

Disable the Activity App - this solves the issue for UPLOADING files for now. But I still have the issue that I get the same error while trying to change/delete a file on a shared link. I donĀ“t have a workaround for that. Anyone else with the same problem?

krocheck commented 4 years ago

Confirmed, disabling the Activity app as a workaround clears this up.

majesty54 commented 4 years ago

not really the same for me :

Indeed:

Activity App already disabled without success

majesty54 commented 4 years ago

After upgrade to 18.0.4 I can now rename a file! But still can't delete any file on the public share.

kaoschris commented 4 years ago

NC Version 18.04

We can't delete any files
We can't rename any file

Activity App already disabled without success Fatal Error.txt

szaimen commented 3 years ago

As I cannot reproduce the original issue anymore, I will close this ticket. If this is still happening please make sure to upgrade to the latest version. After that, feel free to reopen. The latest version can be seen by checking https://nextcloud.com/install/#install-clients and https://nextcloud.com/install/#instructions-server respectively.