]> source.dussan.org Git - nextcloud-server.git/commitdiff
Return proper status when file didn't exist before
authorJulius Härtl <jus@bitgrid.net>
Thu, 13 Aug 2020 13:26:42 +0000 (15:26 +0200)
committerbackportbot[bot] <backportbot[bot]@users.noreply.github.com>
Thu, 13 Aug 2020 18:55:12 +0000 (18:55 +0000)
Signed-off-by: Julius Härtl <jus@bitgrid.net>
apps/dav/lib/Upload/ChunkingPlugin.php

index 74892aaffde9ce905acc69af6d8f11db1ad19356..631111ad12826fac31a5059bf088a1eec52e76af 100644 (file)
@@ -69,6 +69,7 @@ class ChunkingPlugin extends ServerPlugin {
         * @return bool|void false to stop handling, void to skip this handler
         */
        public function performMove($path, $destination) {
+               $fileExists = $this->server->tree->nodeExists($destination);
                // do a move manually, skipping Sabre's default "delete" for existing nodes
                try {
                        $this->server->tree->move($path, $destination);
@@ -87,7 +88,7 @@ class ChunkingPlugin extends ServerPlugin {
 
                $response = $this->server->httpResponse;
                $response->setHeader('Content-Length', '0');
-               $response->setStatus(204);
+               $response->setStatus($fileExists ? 204 : 201);
 
                return false;
        }