@@ -255,8 +255,15 @@ public static function move2trash($file_path, $ownerOnly = false) {
255255 }
256256
257257 $ ownerView = new View ('/ ' . $ owner );
258+
258259 // file has been deleted in between
259- if (is_null ($ ownerPath ) || $ ownerPath === '' || !$ ownerView ->file_exists ('/files/ ' . $ ownerPath )) {
260+ if (is_null ($ ownerPath ) || $ ownerPath === '' ) {
261+ return true ;
262+ }
263+
264+ $ sourceInfo = $ ownerView ->getFileInfo ('/files/ ' . $ ownerPath );
265+
266+ if ($ sourceInfo === false ) {
260267 return true ;
261268 }
262269
@@ -297,9 +304,8 @@ public static function move2trash($file_path, $ownerOnly = false) {
297304 }
298305 }
299306
300- /** @var \OC\Files\Storage\Storage $sourceStorage */
301- [$ sourceStorage , $ sourceInternalPath ] = $ ownerView ->resolvePath ('/files/ ' . $ ownerPath );
302-
307+ $ sourceStorage = $ sourceInfo ->getStorage ();
308+ $ sourceInternalPath = $ sourceInfo ->getInternalPath ();
303309
304310 if ($ trashStorage ->file_exists ($ trashInternalPath )) {
305311 $ trashStorage ->unlink ($ trashInternalPath );
@@ -309,7 +315,7 @@ public static function move2trash($file_path, $ownerOnly = false) {
309315 $ systemTrashbinSize = (int )$ config ->getAppValue ('files_trashbin ' , 'trashbin_size ' , '-1 ' );
310316 $ userTrashbinSize = (int )$ config ->getUserValue ($ owner , 'files_trashbin ' , 'trashbin_size ' , '-1 ' );
311317 $ configuredTrashbinSize = ($ userTrashbinSize < 0 ) ? $ systemTrashbinSize : $ userTrashbinSize ;
312- if ($ configuredTrashbinSize >= 0 && $ sourceStorage -> filesize ( $ sourceInternalPath ) >= $ configuredTrashbinSize ) {
318+ if ($ configuredTrashbinSize >= 0 && $ sourceInfo -> getSize ( ) >= $ configuredTrashbinSize ) {
313319 return false ;
314320 }
315321
0 commit comments