mirror of
https://github.com/nextcloud/server.git
synced 2026-06-11 01:30:50 -04:00
Merge pull request #4960 from owncloud/fixing-mirall-1014-master
handle error situation of rename proper
This commit is contained in:
commit
a79294771b
2 changed files with 15 additions and 2 deletions
|
|
@ -88,7 +88,13 @@ class OC_Connector_Sabre_Directory extends OC_Connector_Sabre_Node implements Sa
|
|||
}
|
||||
|
||||
// rename to correct path
|
||||
\OC\Files\Filesystem::rename($partpath, $newPath);
|
||||
$renameOkay = \OC\Files\Filesystem::rename($partpath, $newPath);
|
||||
$fileExists = \OC\Files\Filesystem::file_exists($newPath);
|
||||
if ($renameOkay === false || $fileExists === false) {
|
||||
\OC_Log::write('webdav', '\OC\Files\Filesystem::rename() failed', \OC_Log::ERROR);
|
||||
\OC\Files\Filesystem::unlink($partpath);
|
||||
throw new Sabre_DAV_Exception();
|
||||
}
|
||||
|
||||
// allow sync clients to send the mtime along in a header
|
||||
$mtime = OC_Request::hasModificationTime();
|
||||
|
|
|
|||
|
|
@ -74,7 +74,14 @@ class OC_Connector_Sabre_File extends OC_Connector_Sabre_Node implements Sabre_D
|
|||
}
|
||||
|
||||
// rename to correct path
|
||||
\OC\Files\Filesystem::rename($partpath, $this->path);
|
||||
$renameOkay = \OC\Files\Filesystem::rename($partpath, $this->path);
|
||||
$fileExists = \OC\Files\Filesystem::file_exists($this->path);
|
||||
if ($renameOkay === false || $fileExists === false) {
|
||||
\OC_Log::write('webdav', '\OC\Files\Filesystem::rename() failed', \OC_Log::ERROR);
|
||||
\OC\Files\Filesystem::unlink($partpath);
|
||||
throw new Sabre_DAV_Exception();
|
||||
}
|
||||
|
||||
|
||||
//allow sync clients to send the mtime along in a header
|
||||
$mtime = OC_Request::hasModificationTime();
|
||||
|
|
|
|||
Loading…
Reference in a new issue