Can't access to the trashbin

Nextcloud version : 15.0.2
Operating system and version Debian 9.6
Apache or nginx version : Apache 2.4.25
PHP version : 7.3.1-1

Hello,

I’ve a problem with Nextcloud 15.0.2, I can’t access to the trashbin.
I’ve test with php7.2 and php7.3.

please see the log:

{"reqId":"HG6d2qICbhYydLwJkVj0","level":3,"time":"2019-01-22T19:46:08+00:00","remoteAddr":"206.123.147.73","user":"nameless","app":"remote","method":"PROPFIND","url":"\/remote.php\/dav\/trashbin\/nameless\/trash","message":{"Exception":"TypeError","Message":"Argument 2 passed to OCA\\Files_Trashbin\\Trash\\TrashItem::__construct() must be of the type string, null given, called in \/var\/www\/html\/noobie.fr\/nextcloud\/apps\/files_trashbin\/lib\/Trash\/LegacyTrashBackend.php on line 57","Code":0,"Trace":[{"file":"\/var\/www\/html\/noobie.fr\/nextcloud\/apps\/files_trashbin\/lib\/Trash\/LegacyTrashBackend.php","line":57,"function":"__construct","class":"OCA\\Files_Trashbin\\Trash\\TrashItem","type":"->","args":["*** sensitive parameter replaced ***",null,1547453857,"\/Logs.d1547453857","*** sensitive parameter replaced ***",{"__class__":"OC\\User\\User"}]},{"function":"OCA\\Files_Trashbin\\Trash\\{closure}","class":"OCA\\Files_Trashbin\\Trash\\LegacyTrashBackend","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"\/var\/www\/html\/noobie.fr\/nextcloud\/apps\/files_trashbin\/lib\/Trash\/LegacyTrashBackend.php","line":55,"function":"array_map","args":[{"__class__":"Closure"},[{"__class__":"OC\\Files\\FileInfo"},{"__class__":"OC\\Files\\FileInfo"},{"__class__":"OC\\Files\\FileInfo"},{"__class__":"OC\\Files\\FileInfo"},{"__class__":"OC\\Files\\FileInfo"},{"__class__":"OC\\Files\\FileInfo"},{"__class__":"OC\\Files\\FileInfo"},{"__class__":"OC\\Files\\FileInfo"},{"__class__":"OC\\Files\\FileInfo"},{"__class__":"OC\\Files\\FileInfo"},{"__class__":"OC\\Files\\FileInfo"},{"__class__":"OC\\Files\\FileInfo"},{"__class__":"OC\\Files\\FileInfo"},{"__class__":"OC\\Files\\FileInfo"},{"__class__":"OC\\Files\\FileInfo"},{"__class__":"OC\\Files\\FileInfo"},{"__class__":"OC\\Files\\FileInfo"},{"__class__":"OC\\Files\\FileInfo"},{"__class__":"OC\\Files\\FileInfo"},{"__class__":"OC\\Files\\FileInfo"},{"__class__":"OC\\Files\\FileInfo"},{"__class__":"OC\\Files\\FileInfo"},{"__class__":"OC\\Files\\FileInfo"},{"__class__":"OC\\Files\\FileInfo"},{"__class__":"OC\\Files\\FileInfo"},{"__class__":"OC\\Files\\FileInfo"},{"__class__":"OC\\Files\\FileInfo"},{"__class__":"OC\\Files\\FileInfo"},{"__class__":"OC\\Files\\FileInfo"},{"__class__":"OC\\Files\\FileInfo"},{"__class__":"OC\\Files\\FileInfo"},{"__class__":"OC\\Files\\FileInfo"},{"__class__":"OC\\Files\\FileInfo"},{"__class__":"OC\\Files\\FileInfo"},{"__class__":"OC\\Files\\FileInfo"},{"__class__":"OC\\Files\\FileInfo"}]]},{"file":"\/var\/www\/html\/noobie.fr\/nextcloud\/apps\/files_trashbin\/lib\/Trash\/LegacyTrashBackend.php","line":69,"function":"mapTrashItems","class":"OCA\\Files_Trashbin\\Trash\\LegacyTrashBackend","type":"->","args":[[{"__class__":"OC\\Files\\FileInfo"},{"__class__":"OC\\Files\\FileInfo"},{"__class__":"OC\\Files\\FileInfo"},{"__class__":"OC\\Files\\FileInfo"},{"__class__":"OC\\Files\\FileInfo"},{"__class__":"OC\\Files\\FileInfo"},{"__class__":"OC\\Files\\FileInfo"},{"__class__":"OC\\Files\\FileInfo"},{"__class__":"OC\\Files\\FileInfo"},{"__class__":"OC\\Files\\FileInfo"},{"__class__":"OC\\Files\\FileInfo"},{"__class__":"OC\\Files\\FileInfo"},{"__class__":"OC\\Files\\FileInfo"},{"__class__":"OC\\Files\\FileInfo"},{"__class__":"OC\\Files\\FileInfo"},{"__class__":"OC\\Files\\FileInfo"},{"__class__":"OC\\Files\\FileInfo"},{"__class__":"OC\\Files\\FileInfo"},{"__class__":"OC\\Files\\FileInfo"},{"__class__":"OC\\Files\\FileInfo"},{"__class__":"OC\\Files\\FileInfo"},{"__class__":"OC\\Files\\FileInfo"},{"__class__":"OC\\Files\\FileInfo"},{"__class__":"OC\\Files\\FileInfo"},{"__class__":"OC\\Files\\FileInfo"},{"__class__":"OC\\Files\\FileInfo"},{"__class__":"OC\\Files\\FileInfo"},{"__class__":"OC\\Files\\FileInfo"},{"__class__":"OC\\Files\\FileInfo"},{"__class__":"OC\\Files\\FileInfo"},{"__class__":"OC\\Files\\FileInfo"},{"__class__":"OC\\Files\\FileInfo"},{"__class__":"OC\\Files\\FileInfo"}],{"__class__":"OC\\User\\User"}]},{"file":"\/var\/www\/html\/noobie.fr\/nextcloud\/apps\/files_trashbin\/lib\/Trash\/TrashManager.php","line":48,"function":"listTrashRoot","class":"OCA\\Files_Trashbin\\Trash\\LegacyTrashBackend","type":"->","args":[{"__class__":"OC\\User\\User"}]},{"function":"OCA\\Files_Trashbin\\Trash\\{closure}","class":"OCA\\Files_Trashbin\\Trash\\TrashManager","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"\/var\/www\/html\/noobie.fr\/nextcloud\/apps\/files_trashbin\/lib\/Trash\/TrashManager.php","line":49,"function":"array_reduce","args":[{"OCP\\Files\\Storage\\IStorage":"*** sensitive parameter replaced ***"},{"__class__":"Closure"},"*** sensitive parameter replaced ***"]},{"file":"\/var\/www\/html\/noobie.fr\/nextcloud\/apps\/files_trashbin\/lib\/Sabre\/TrashRoot.php","line":68,"function":"listTrashRoot","class":"OCA\\Files_Trashbin\\Trash\\TrashManager","type":"->","args":[{"__class__":"OC\\User\\User"}]},{"file":"\/var\/www\/html\/noobie.fr\/nextcloud\/3rdparty\/sabre\/dav\/lib\/DAV\/Tree.php","line":195,"function":"getChildren","class":"OCA\\Files_Trashbin\\Sabre\\TrashRoot","type":"->","args":[]},{"file":"\/var\/www\/html\/noobie.fr\/nextcloud\/3rdparty\/sabre\/dav\/lib\/DAV\/Server.php","line":899,"function":"getChildren","class":"Sabre\\DAV\\Tree","type":"->","args":["trashbin\/nameless\/trash"]},{"file":"\/var\/www\/html\/noobie.fr\/nextcloud\/3rdparty\/sabre\/dav\/lib\/DAV\/Server.php","line":978,"function":"generatePathNodes","class":"Sabre\\DAV\\Server","type":"->","args":[{"__class__":"Sabre\\DAV\\PropFind"},[{"__class__":"Sabre\\DAV\\PropFind"},{"__class__":"OCA\\Files_Trashbin\\Sabre\\TrashRoot"}]]},{"file":"\/var\/www\/html\/noobie.fr\/nextcloud\/3rdparty\/sabre\/dav\/lib\/DAV\/Server.php","line":1666,"function":"getPropertiesIteratorForPath","class":"Sabre\\DAV\\Server","type":"->","args":["trashbin\/nameless\/trash",["{http:\/\/nextcloud.org\/ns}trashbin-filename","{http:\/\/nextcloud.org\/ns}trashbin-deletion-time","{DAV:}getlastmodified","{DAV:}getetag","{DAV:}getcontenttype","{DAV:}resourcetype","{http:\/\/owncloud.org\/ns}fileid","{http:\/\/owncloud.org\/ns}permissions","{http:\/\/owncloud.org\/ns}size","{DAV:}getcontentlength","{http:\/\/nextcloud.org\/ns}has-preview","{http:\/\/nextcloud.org\/ns}mount-type","{http:\/\/nextcloud.org\/ns}is-encrypted","{http:\/\/open-collaboration-services.org\/ns}share-permissions","{http:\/\/owncloud.org\/ns}comments-unread"],1]},{"file":"\/var\/www\/html\/noobie.fr\/nextcloud\/3rdparty\/sabre\/dav\/lib\/DAV\/CorePlugin.php","line":355,"function":"generateMultiStatus","class":"Sabre\\DAV\\Server","type":"->","args":[{"__class__":"Generator"},false]},{"function":"httpPropFind","class":"Sabre\\DAV\\CorePlugin","type":"->","args":[{"absoluteUrl":"https:\/\/cloud.noobie.fr\/remote.php\/dav\/trashbin\/nameless\/trash","__class__":"Sabre\\HTTP\\Request"},{"__class__":"Sabre\\HTTP\\Response"}]},{"file":"\/var\/www\/html\/noobie.fr\/nextcloud\/3rdparty\/sabre\/event\/lib\/EventEmitterTrait.php","line":105,"function":"call_user_func_array","args":[[{"__class__":"Sabre\\DAV\\CorePlugin"},"httpPropFind"],[{"absoluteUrl":"https:\/\/cloud.noobie.fr\/remote.php\/dav\/trashbin\/nameless\/trash","__class__":"Sabre\\HTTP\\Request"},{"__class__":"Sabre\\HTTP\\Response"}]]},{"file":"\/var\/www\/html\/noobie.fr\/nextcloud\/3rdparty\/sabre\/dav\/lib\/DAV\/Server.php","line":479,"function":"emit","class":"Sabre\\Event\\EventEmitter","type":"->","args":["method:PROPFIND",[{"absoluteUrl":"https:\/\/cloud.noobie.fr\/remote.php\/dav\/trashbin\/nameless\/trash","__class__":"Sabre\\HTTP\\Request"},{"__class__":"Sabre\\HTTP\\Response"}]]},{"file":"\/var\/www\/html\/noobie.fr\/nextcloud\/3rdparty\/sabre\/dav\/lib\/DAV\/Server.php","line":254,"function":"invokeMethod","class":"Sabre\\DAV\\Server","type":"->","args":[{"absoluteUrl":"https:\/\/cloud.noobie.fr\/remote.php\/dav\/trashbin\/nameless\/trash","__class__":"Sabre\\HTTP\\Request"},{"__class__":"Sabre\\HTTP\\Response"}]},{"file":"\/var\/www\/html\/noobie.fr\/nextcloud\/apps\/dav\/lib\/Server.php","line":301,"function":"exec","class":"Sabre\\DAV\\Server","type":"->","args":[]},{"file":"\/var\/www\/html\/noobie.fr\/nextcloud\/apps\/dav\/appinfo\/v2\/remote.php","line":35,"function":"exec","class":"OCA\\DAV\\Server","type":"->","args":[]},{"file":"\/var\/www\/html\/noobie.fr\/nextcloud\/remote.php","line":163,"args":["\/var\/www\/html\/noobie.fr\/nextcloud\/apps\/dav\/appinfo\/v2\/remote.php"],"function":"require_once"}],"File":"\/var\/www\/html\/noobie.fr\/nextcloud\/apps\/files_trashbin\/lib\/Trash\/TrashItem.php","Line":41,"CustomMessage":"--"},"userAgent":"Mozilla\/5.0 (X11; Fedora; Linux x86_64; rv:64.0) Gecko\/20100101 Firefox\/64.0","version":"15.0.2.0"}

same problem here.

my logs:

    [webdav] Fatal: Sabre\DAV\Exception\UnsupportedMediaType: Validation error in iCalendar: More than one master object was found for the object with UID 6cfcef75-4302-42eb-b7b8-81d11e76fc2c at <<closure>>

 0. /var/www/html/owncloud/3rdparty/sabre/dav/lib/CalDAV/Plugin.php line 772
    validateICalendar("BEGIN:VCALENDAR ... n", "calendars/xxxx ... s", false, Sabre\HTTP\Reque ... "}, Sabre\HTTP\Response {}, false)
 1. <<closure>>
    beforeWriteContent("calendars/xxxx ... s", OCA\DAV\CalDAV\CalendarObject {}, "BEGIN:VCALENDAR ... n", false)
 2. /var/www/html/owncloud/3rdparty/sabre/event/lib/EventEmitterTrait.php line 105
    call_user_func_array([OCA\DAV\CalDAV\ ... "], ["calendars/pasc ... e])
 3. /var/www/html/owncloud/3rdparty/sabre/dav/lib/DAV/Server.php line 1128
    emit("beforeWriteContent", ["calendars/pasc ... e])
 4. /var/www/html/owncloud/3rdparty/sabre/dav/lib/DAV/CorePlugin.php line 513
    updateFile("calendars/xxxx ... s", "BEGIN:VCALENDAR ... n", null)
 5. <<closure>>
    httpPut(Sabre\HTTP\Reque ... "}, Sabre\HTTP\Response {})
 6. /var/www/html/owncloud/3rdparty/sabre/event/lib/EventEmitterTrait.php line 105
    call_user_func_array([Sabre\DAV\CorePlugin {},"httpPut"], [Sabre\HTTP\Requ ... }])
 7. /var/www/html/owncloud/3rdparty/sabre/dav/lib/DAV/Server.php line 479
    emit("method:PUT", [Sabre\HTTP\Requ ... }])
 8. /var/www/html/owncloud/3rdparty/sabre/dav/lib/DAV/Server.php line 254
    invokeMethod(Sabre\HTTP\Reque ... "}, Sabre\HTTP\Response {})
 9. /var/www/html/owncloud/apps/dav/lib/Server.php line 301
    exec()
10. /var/www/html/owncloud/apps/dav/appinfo/v2/remote.php line 35
    exec()
11. /var/www/html/owncloud/remote.php line 163
    require_once("/var/www/html/o ... p")

PUT /owncloud/remote.php/dav/calendars/xxx/0e9363c8-3985-421f-9669-ddd0cbd5de0c_shared_by_xxxx/6cfcef75-4302-42eb-b7b8-81d11e76fc2c.ics
from 62.102.148.68 by xxx at 2019-01-22T20:20:21+00:00

[remote] Error: TypeError: Return value of OCA\Files_Trashbin\Sabre\AbstractTrash::getSize() must be of the type int, float returned at <<closure>>

 0. /var/www/html/owncloud/apps/files_trashbin/lib/Sabre/PropfindPlugin.php line 78
    getSize()
 1. /var/www/html/owncloud/3rdparty/sabre/dav/lib/DAV/PropFind.php line 98
    OCA\Files_Trashbin\Sabre\{closure}("*** sensitive parameters replaced ***")
 2. /var/www/html/owncloud/apps/files_trashbin/lib/Sabre/PropfindPlugin.php line 79
    handle("{http://owncloud.org/ns}size", Closure {})
 3. <<closure>>
    propFind(Sabre\DAV\PropFind {}, OCA\Files_Trashbin\Sabre\TrashFolder {})
 4. /var/www/html/owncloud/3rdparty/sabre/event/lib/EventEmitterTrait.php line 105
    call_user_func_array([OCA\Files_Trash ... "], [Sabre\DAV\PropF ... }])
 5. /var/www/html/owncloud/3rdparty/sabre/dav/lib/DAV/Server.php line 1059
    emit("propFind", [Sabre\DAV\PropF ... }])
 6. /var/www/html/owncloud/3rdparty/sabre/dav/lib/DAV/Server.php line 981
    getPropertiesByNode(Sabre\DAV\PropFind {}, OCA\Files_Trashbin\Sabre\TrashFolder {})
 7. /var/www/html/owncloud/3rdparty/sabre/dav/lib/DAV/Server.php line 1666
    getPropertiesIteratorForPath("trashbin/xxxx/trash", ["{http://nextcl ... "], 1)
 8. /var/www/html/owncloud/3rdparty/sabre/dav/lib/DAV/CorePlugin.php line 355
    generateMultiStatus(Generator {}, false)
 9. <<closure>>
    httpPropFind(Sabre\HTTP\Reque ... "}, Sabre\HTTP\Response {})
10. /var/www/html/owncloud/3rdparty/sabre/event/lib/EventEmitterTrait.php line 105
    call_user_func_array([Sabre\DAV\CorePlugin {},"httpPropFind"], [Sabre\HTTP\Requ ... }])
11. /var/www/html/owncloud/3rdparty/sabre/dav/lib/DAV/Server.php line 479
    emit("method:PROPFIND", [Sabre\HTTP\Requ ... }])
12. /var/www/html/owncloud/3rdparty/sabre/dav/lib/DAV/Server.php line 254
    invokeMethod(Sabre\HTTP\Reque ... "}, Sabre\HTTP\Response {})
13. /var/www/html/owncloud/apps/dav/lib/Server.php line 301
    exec()
14. /var/www/html/owncloud/apps/dav/appinfo/v2/remote.php line 35
    exec()
15. /var/www/html/owncloud/remote.php line 163
    require_once("/var/www/html/o ... p")

PROPFIND /owncloud/remote.php/dav/trashbin/xxxx/trash
from 87.123.193.166 by xxxx at 2019-01-22T17:26:49+00:10

there seems to be an issue on github 14 days old…

1 Like

I have the same problem

The solution is on this page:

I fixed it locally by explicitly casting to int in method getSize() in AbstractTrash.php. It now looks like this now:

public function getSize(): int {
   return (int)$this->data->getSize();
}

Can you please include this in the code of Nextcloud?

That fix works for me. Thanks for posting it!

Has this change already made it to one of the official images yet?

How am I supposed to act now when I have that problem?
I can’t edit the AbstractTrash.php because it is a read only File and I don’t wanna change this on my own in any way.
I am running it on a RPi4 with a 16.0.5 Nextcloud Version.

I think there are two options:

  • Wait until the problem has been fixed in a coming release.
  • Apply the given path to the file. It is usually easy to change the read-only- state of the file to read/write, edit the file, and revert the access files to read-only again.

Thank you j-ed for the answer, I was able to empty the trashbin through the mobile app, regardless of the app not being able to display the files in the trashbin.

Yes, this code solve my issue of trash bin not showing files problem. I’m using nextcloud v17.0.3.

I fixed it locally by explicitly casting to int in method getSize() in AbstractTrash.php. It now looks like this now:

public function getSize(): int {

return (int)$this->data->getSize();
}

hello, i have some problem. how to change my file?

It was easy for me to do this! Follow this steps and on my server it works!

  1. Deactivate APP Deletet Files
  2. Reboot your Nextcloud
  3. Activate APP Deletet Files
  4. Delete one File
  5. Trashbin was working

Funktioniert bei mir leider nicht. Ich verwende einen Raspberry pi 4 und Nextcloud 18.
Ich bin gerade draufgekommen das mir ein ganzer Ordner Bilder abgeht und wollte ihn im gelöschten Ordner suchen dieser lässt sich aber nicht öffnen… Ich möchte jetzt ungern was verändern falls es da noch was zu retten gibt

Öffne eine Shell und schaue in das data/[user]/files_trashbin/files-Verzeichnis. Dort solltest Du alle gelöschten Dateien finden.

Danke für den Tipp habe Leider die Dateien nicht finden können die ich suchte. Aber das hilft schon mal weiter :slight_smile:

I just solved it with this method in the latest version of Nextcloud for rpi 3,
ORIGINAL
public function getSize(): int {
return $this->data->getSize();
}
CORRECTED
public function getSize(): int {
return (int)$this->data->getSize();
}

the path for which you don’t know it is :
/var/www/nextcloud/apps/files_trashbin/lib/Sabre/AbstractTrash.php
Thanks

6 Likes

Worked for me. Thank you very much

For some reason, the problem just occurred again. Thanks for your tip, by forcing (int) the error message no longer appears and I can access my trash again! Hurray!

1 Like

My System is Raspi 3 with Raspian Buster. NextCloud Version 21.0.1

The Bug with the Trash is still there. On my system it occurred, when I added external smb storage from a Synology box.

The described fix from fernandoJG worked for me as well.
One would be enforced to repeat that every time after an update.

How can this fix be integrated into the official fork?

Best regards and many thanks for the solution.