]> source.dussan.org Git - nextcloud-server.git/commitdiff
fix error on delete in ChunkingV2Plugin 38100/head
authorLorenzo Tanganelli <35271287+tanganellilore@users.noreply.github.com>
Fri, 5 May 2023 12:56:55 +0000 (12:56 +0000)
committerLorenzo Tanganelli <lorenzo.tanganelli@hotmail.it>
Fri, 5 May 2023 13:07:58 +0000 (13:07 +0000)
Signed-off-by: Lorenzo Tanganelli <lorenzo.tanganelli@hotmail.it>
apps/dav/lib/Upload/ChunkingV2Plugin.php

index cb7c802125c279794454acba00955486866841f3..6b660fb7c6f95f9baac5690f7a176a968c2b253a 100644 (file)
@@ -255,17 +255,15 @@ class ChunkingV2Plugin extends ServerPlugin {
 
        public function beforeDelete(RequestInterface $request, ResponseInterface $response) {
                try {
-                       $this->prepareUpload($request->getPath());
-                       if (!$this->uploadFolder instanceof UploadFolder) {
-                               return true;
-                       }
-
-                       [$storage, $storagePath] = $this->getUploadStorage($this->uploadPath);
-                       $storage->cancelChunkedWrite($storagePath, $this->uploadId);
-                       return true;
-               } catch (NotFound $e) {
+                       $this->prepareUpload(dirname($request->getPath()));
+                       $this->checkPrerequisites();
+               } catch (StorageInvalidException|BadRequest|NotFound $e) {
                        return true;
                }
+
+               [$storage, $storagePath] = $this->getUploadStorage($this->uploadPath);
+               $storage->cancelChunkedWrite($storagePath, $this->uploadId);
+               return true;
        }
 
        /**