Error deleting file - "OCP\Files\NotFoundException"

Nextcloud version: 18.0.4
Operating system and version: Ubuntu 18.04.4
Apache or nginx version: Apache 2.4.29
PHP version: 7.2.24

The issue you are facing: After Nextcloud upgrade from 17.0.1 to 18.0.4 and apt-get upgrade in Ubuntu 18.04 it’s impossible to delete files via shared links. Error deleting file “…” occurs in web interface. But if you login as user you can delete the same files from external storage. Creating and renaming works, the issue is only with deleting after opening shared link.

Is this the first time you’ve seen this error? : Y

Steps to replicate it:

  1. Upgrade Nextcloud from 17.0.1 to 18.0.4
  2. Apt-get upgrade

The output of your Nextcloud log in Admin > Logging:

[webdav] Fatal: OCP\Files\NotFoundException: Server/Design/...Cop333y.docx has no owner at <<closure>>

 0. /var/www/html/nextcloud/lib/private/Files/Filesystem.php line 907
    OC\Files\View->getOwner("Server/Design/1 ... x")
 1. /var/www/html/nextcloud/apps/files_trashbin/lib/Trashbin.php line 91
    OC\Files\Filesystem::getOwner("Server/Design/1 ... x")
 2. /var/www/html/nextcloud/apps/files_trashbin/lib/Trashbin.php line 224
    OCA\Files_Trashbin\Trashbin::getUidAndFilename("Server/Design/1 ... x")
 3. /var/www/html/nextcloud/apps/files_trashbin/lib/Trash/LegacyTrashBackend.php line 109
    OCA\Files_Trashbin\Trashbin::move2trash("Server/Design/1 ... x")
 4. /var/www/html/nextcloud/apps/files_trashbin/lib/Trash/TrashManager.php line 105
    OCA\Files_Trashbin\Trash\LegacyTrashBackend->moveToTrash(OCA\Files_Trashb ... l}, "Design/1. Partn ... x")
 5. /var/www/html/nextcloud/apps/files_trashbin/lib/Storage.php line 193
    OCA\Files_Trashbin\Trash\TrashManager->moveToTrash(OCA\Files_Trashb ... l}, "Design/1. Partn ... x")
 6. /var/www/html/nextcloud/apps/files_trashbin/lib/Storage.php line 100
    OCA\Files_Trashbin\Storage->doDelete("Design/1. Partn ... x", "unlink")
 7. /var/www/html/nextcloud/lib/private/Files/View.php line 1162
    OCA\Files_Trashbin\Storage->unlink("Design/1. Partn ... x")
 8. /var/www/html/nextcloud/lib/private/Files/View.php line 716
    OC\Files\View->basicOperation("unlink", "/1. SUPERSEDED  ... x", ["delete"])
 9. /var/www/html/nextcloud/apps/dav/lib/Connector/Sabre/File.php line 448
    OC\Files\View->unlink("/1. SUPERSEDED  ... x")
10. /var/www/html/nextcloud/3rdparty/sabre/dav/lib/DAV/Tree.php line 179
    OCA\DAV\Connector\Sabre\File->delete()
11. /var/www/html/nextcloud/3rdparty/sabre/dav/lib/DAV/CorePlugin.php line 287
    Sabre\DAV\Tree->delete("1. SUPERSEDED - ... x")
12. <<closure>>
    Sabre\DAV\CorePlugin->httpDelete(Sabre\HTTP\Reque ... "}, Sabre\HTTP\Response {})
13. /var/www/html/nextcloud/3rdparty/sabre/event/lib/EventEmitterTrait.php line 105
    call_user_func_array([Sabre\DAV\CorePlugin {},"httpDelete"], [Sabre\HTTP\Requ ... }])
14. /var/www/html/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php line 479
    Sabre\Event\EventEmitter->emit("method:DELETE", [Sabre\HTTP\Requ ... }])
15. /var/www/html/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php line 254
    Sabre\DAV\Server->invokeMethod(Sabre\HTTP\Reque ... "}, Sabre\HTTP\Response {})
16. /var/www/html/nextcloud/apps/dav/appinfo/v1/publicwebdav.php line 109
    Sabre\DAV\Server->exec()
17. /var/www/html/nextcloud/public.php line 81
    require_once("/var/www/html/n ... p")

DELETE /public.php/webdav/1.%20SUPERSEDED...Cop333y.docx
from x.x.x.x at 2020-05-21T20:11:53+00:00

Second error (happens from time to time)
[no app in context] Error: Icewind\SMB\Exception\ForbiddenException: Invalid request for / (ForbiddenException) at <<closure>>

 0. /var/www/html/nextcloud/apps/files_external/3rdparty/icewind/smb/src/Native/NativeState.php line 66
    Icewind\SMB\Exception\Exception::fromMap({1: "Icewind\\SM ... "}, 1, "/")
 1. /var/www/html/nextcloud/apps/files_external/3rdparty/icewind/smb/src/Native/NativeState.php line 78
    Icewind\SMB\Native\NativeState->handleError("/")
 2. /var/www/html/nextcloud/apps/files_external/3rdparty/icewind/smb/src/Native/NativeState.php line 294
    Icewind\SMB\Native\NativeState->testResult("*** sensitive parameter replaced ***", "smb://....")
 3. /var/www/html/nextcloud/apps/files_external/3rdparty/icewind/smb/src/Native/NativeShare.php line 306
    Icewind\SMB\Native\NativeState->getxattr("smb://...", "system.dos_attr.*")
 4. /var/www/html/nextcloud/apps/files_external/3rdparty/icewind/smb/src/Native/NativeFileInfo.php line 69
    Icewind\SMB\Native\NativeShare->getAttribute("/", "system.dos_attr.*")
 5. /var/www/html/nextcloud/apps/files_external/3rdparty/icewind/smb/src/Native/NativeFileInfo.php line 88
    Icewind\SMB\Native\NativeFileInfo->stat()
 6. /var/www/html/nextcloud/apps/files_external/3rdparty/icewind/smb/src/Native/NativeShare.php line 113
    Icewind\SMB\Native\NativeFileInfo->getSize()
 7. /var/www/html/nextcloud/apps/files_external/lib/Lib/Storage/SMB.php line 179
    Icewind\SMB\Native\NativeShare->stat("/")
 8. /var/www/html/nextcloud/apps/files_external/lib/Lib/Storage/SMB.php line 297
    OCA\Files_External\Lib\Storage\SMB->getFileInfo("/")
 9. /var/www/html/nextcloud/lib/private/Files/Storage/Common.php line 456
    OCA\Files_External\Lib\Storage\SMB->stat("")
10. /var/www/html/nextcloud/apps/files_external/lib/Lib/Storage/SMB.php line 613
    OC\Files\Storage\Common->test()
11. /var/www/html/nextcloud/apps/files_external/lib/config.php line 262
    OCA\Files_External\Lib\Storage\SMB->test("*** sensitive parameter replaced ***", "*** sensitive parameter replaced ***")
12. /var/www/html/nextcloud/apps/files_external/lib/Controller/StoragesController.php line 258
    OC_Mount_Config::getBackendStatus("*** sensitive parameters replaced ***")
13. /var/www/html/nextcloud/apps/files_external/lib/Controller/UserGlobalStoragesController.php line 123
    OCA\Files_External\Controller\StoragesController->updateStorageStatus("*** sensitive parameters replaced ***")
14. /var/www/html/nextcloud/lib/private/AppFramework/Http/Dispatcher.php line 170
    OCA\Files_External\Controller\UserGlobalStoragesController->show(1, "*** sensitive parameter replaced ***")
15. /var/www/html/nextcloud/lib/private/AppFramework/Http/Dispatcher.php line 99
    OC\AppFramework\Http\Dispatcher->executeController(OCA\Files_Extern ... {}, "show")
16. /var/www/html/nextcloud/lib/private/AppFramework/App.php line 125
    OC\AppFramework\Http\Dispatcher->dispatch(OCA\Files_Extern ... {}, "show")
17. /var/www/html/nextcloud/lib/private/AppFramework/Routing/RouteActionHandler.php line 47
    OC\AppFramework\App::main("OCA\\Files_Exte ... r", "show", OC\AppFramework\ ... {}, {id: "1",_route: ... "})
18. <<closure>>
    OC\AppFramework\Routing\RouteActionHandler->__invoke({id: "1",_route: ... "})
19. /var/www/html/nextcloud/lib/private/Route/Router.php line 299
    call_user_func(OC\AppFramework\ ... {}, {id: "1",_route: ... "})
20. /var/www/html/nextcloud/lib/base.php line 1008
    OC\Route\Router->match("/apps/files_ext ... 1")
21. /var/www/html/nextcloud/index.php line 38
    OC::handleRequest()

GET /index.php/apps/files_external/userglobalstorages/1?testOnly=false
from x.x.x.x by admin at 2020-05-21T20:26:19+00:00

The output of your config.php file in /path/to/nextcloud:

<?php
$CONFIG = array (
  'instanceid' => '',
  'passwordsalt' => '',
  'secret' => '',
  'trusted_domains' => 
  array (
    0 => '',
  ),
  'datadirectory' => '/var/www/html/nextcloud/data',
  'dbtype' => 'mysql',
  'version' => '18.0.4.2',
  'overwrite.cli.url' => '',
  'htaccess.RewriteBase' => '/',
  'dbname' => 'nextcloud',
  'dbhost' => 'localhost',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => '',
  'dbpassword' => '',
  'installed' => true,
  'memcache.local' => '\\OC\\Memcache\\Redis',
  'memcache.locking' => '\\OC\\Memcache\\Redis',
  'filelocking.enabled' => 'true',
  'redis' => 
  array (
    'host' => '/var/run/redis/redis-server.sock',
    'port' => 0,
    'timeout' => 0.0,
  ),
  'ldapIgnoreNamingRules' => false,
  'ldapProviderFactory' => 'OCA\\User_LDAP\\LDAPProviderFactory',
  'maintenance' => false,
  'theme' => '',
  'loglevel' => 2,
  'updater.secret' => '',
);