Return proper status when file didn't exist before
Signed-off-by: Julius Härtl <jus@bitgrid.net>
This commit is contained in:
parent
cda5cfc01e
commit
6722246aca
|
@ -88,6 +88,7 @@ class ChunkingPlugin extends ServerPlugin {
|
||||||
* @return bool|void false to stop handling, void to skip this handler
|
* @return bool|void false to stop handling, void to skip this handler
|
||||||
*/
|
*/
|
||||||
public function performMove($path, $destination) {
|
public function performMove($path, $destination) {
|
||||||
|
$fileExists = $this->server->tree->nodeExists($destination);
|
||||||
// do a move manually, skipping Sabre's default "delete" for existing nodes
|
// do a move manually, skipping Sabre's default "delete" for existing nodes
|
||||||
try {
|
try {
|
||||||
$this->server->tree->move($path, $destination);
|
$this->server->tree->move($path, $destination);
|
||||||
|
@ -106,7 +107,7 @@ class ChunkingPlugin extends ServerPlugin {
|
||||||
|
|
||||||
$response = $this->server->httpResponse;
|
$response = $this->server->httpResponse;
|
||||||
$response->setHeader('Content-Length', '0');
|
$response->setHeader('Content-Length', '0');
|
||||||
$response->setStatus(204);
|
$response->setStatus($fileExists ? 204 : 201);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -133,7 +133,7 @@ class ChunkingPluginTest extends TestCase {
|
||||||
->with('Content-Length', '0');
|
->with('Content-Length', '0');
|
||||||
$this->response->expects($this->once())
|
$this->response->expects($this->once())
|
||||||
->method('setStatus')
|
->method('setStatus')
|
||||||
->with(204);
|
->with(201);
|
||||||
$this->request->expects($this->once())
|
$this->request->expects($this->once())
|
||||||
->method('getHeader')
|
->method('getHeader')
|
||||||
->with('OC-Total-Length')
|
->with('OC-Total-Length')
|
||||||
|
|
Loading…
Reference in New Issue