@@ -229,7 +229,7 @@ public function put($data) {
229229 // double check if the file was fully received
230230 // compare expected and actual size
231231 if (isset ($ _SERVER ['CONTENT_LENGTH ' ]) && $ _SERVER ['REQUEST_METHOD ' ] === 'PUT ' ) {
232- $ expected = $ _SERVER ['CONTENT_LENGTH ' ];
232+ $ expected = $ _SERVER ['CONTENT_LENGTH ' ] + 1 ;
233233 if ($ count != $ expected ) {
234234 throw new BadRequest ('expected filesize ' . $ expected . ' got ' . $ count );
235235 }
@@ -490,7 +490,7 @@ private function createFileChunked($data) {
490490 //detect aborted upload
491491 if (isset ($ _SERVER ['REQUEST_METHOD ' ]) && $ _SERVER ['REQUEST_METHOD ' ] === 'PUT ' ) {
492492 if (isset ($ _SERVER ['CONTENT_LENGTH ' ])) {
493- $ expected = $ _SERVER ['CONTENT_LENGTH ' ];
493+ $ expected = $ _SERVER ['CONTENT_LENGTH ' ] + 1 ;
494494 if ($ bytesWritten != $ expected ) {
495495 $ chunk_handler ->remove ($ info ['index ' ]);
496496 throw new BadRequest (
@@ -738,7 +738,11 @@ private function cleanFailedUpload(Storage $partStorage, $internalPartPath): voi
738738 if (class_exists (\OCA \Files_Trashbin \Storage::class)) {
739739 \OCA \Files_Trashbin \Storage::$ disableTrash = true ;
740740 }
741+ # delete file from storage
741742 $ partStorage ->unlink ($ internalPartPath );
743+ # delete file from cache
744+ $ partStorage ->getCache ()->remove ($ internalPartPath );
745+
742746 } finally {
743747 if (class_exists (\OCA \Files_Trashbin \Storage::class)) {
744748 \OCA \Files_Trashbin \Storage::$ disableTrash = false ;
0 commit comments