@@ -107,13 +107,20 @@ protected function isBlockablePath(IStorage $storage, string $path): bool {
107107 }
108108
109109 // '', admin, 'files', 'path/to/file.txt'
110- $ segment = explode ('/ ' , $ fullPath , 4 );
110+ // '', admin, 'files_trashbin', 'versions', 'path/to/file.txt'
111+ $ segment = explode ('/ ' , $ fullPath , 5 );
111112
112113 if (isset ($ segment [2 ]) && $ segment [1 ] === '__groupfolders ' && $ segment [2 ] === 'trash ' ) {
113114 // Special case, a file was deleted inside a groupfolder
114115 return true ;
115116 }
116117
118+ if (isset ($ segment [3 ]) && $ segment [2 ] === 'files_trashbin '
119+ && ($ segment [3 ] === 'keys ' || !isset ($ segment [4 ]))) {
120+ // Ignore encryption keys in trashbin and the files and version folder themselves
121+ return false ;
122+ }
123+
117124 return isset ($ segment [2 ]) && in_array ($ segment [2 ], [
118125 'files ' ,
119126 'thumbnails ' ,
@@ -138,6 +145,25 @@ protected function translatePath(IStorage $storage, string $path): string {
138145 // Remove trailing ".v{timestamp}"
139146 $ innerPath = substr ($ innerPath , 0 , -12 );
140147 }
148+ return 'files/ ' . $ innerPath ;
149+ } elseif ($ folder === 'files_trashbin ' ) {
150+ // 'files', 'path/to/file.txt'
151+ // 'versions', 'path/to/file.txt'
152+ $ segments = explode ('/ ' , $ innerPath , 2 );
153+ if (isset ($ segments [1 ])) {
154+ $ innerPath = $ segments [1 ];
155+ }
156+
157+ if (preg_match ('/.+\.d\d{10}$/ ' , basename ($ innerPath ))) {
158+ // Remove trailing ".d{timestamp}" of trashbin
159+ $ innerPath = substr ($ innerPath , 0 , -12 );
160+ }
161+
162+ if ($ folder === 'versions ' && preg_match ('/.+\.v\d{10}$/ ' , basename ($ innerPath ))) {
163+ // Remove trailing ".v{timestamp}" of versions inside trashbin
164+ $ innerPath = substr ($ innerPath , 0 , -12 );
165+ }
166+
141167 return 'files/ ' . $ innerPath ;
142168 } elseif ($ folder === 'thumbnails ' ) {
143169 [$ fileId ,] = explode ('/ ' , $ innerPath , 2 );
0 commit comments