]> source.dussan.org Git - nextcloud-server.git/commitdiff
fix error on delete in ChunkingV2Plugin 38167/head
authorLorenzo Tanganelli <35271287+tanganellilore@users.noreply.github.com>
Fri, 5 May 2023 12:56:55 +0000 (12:56 +0000)
committerbackportbot-nextcloud[bot] <backportbot-nextcloud[bot]@users.noreply.github.com>
Wed, 10 May 2023 06:51:51 +0000 (06:51 +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;
        }
 
        /**