Fix WebDAV uploading of partial shared files
This commit is contained in:
parent
09a2730f57
commit
b6a21cc4b5
|
@ -45,10 +45,20 @@ class Shared extends \OC\Files\Storage\Common {
|
||||||
*/
|
*/
|
||||||
private function getFile($target) {
|
private function getFile($target) {
|
||||||
if (!isset($this->files[$target])) {
|
if (!isset($this->files[$target])) {
|
||||||
|
// Check for partial files
|
||||||
|
if (pathinfo($target, PATHINFO_EXTENSION) === 'part') {
|
||||||
|
$source = \OC_Share_Backend_File::getSource(substr($target, 0, -5));
|
||||||
|
if ($source) {
|
||||||
|
$source['path'] = '/'.$source['uid_owner'].'/'.$source['path'].'.part';
|
||||||
|
// All partial files have delete permission
|
||||||
|
$source['permissions'] |= \OCP\PERMISSION_DELETE;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
$source = \OC_Share_Backend_File::getSource($target);
|
$source = \OC_Share_Backend_File::getSource($target);
|
||||||
if ($source) {
|
if ($source) {
|
||||||
$source['path'] = '/'.$source['uid_owner'].'/'.$source['path'];
|
$source['path'] = '/'.$source['uid_owner'].'/'.$source['path'];
|
||||||
}
|
}
|
||||||
|
}
|
||||||
$this->files[$target] = $source;
|
$this->files[$target] = $source;
|
||||||
}
|
}
|
||||||
return $this->files[$target];
|
return $this->files[$target];
|
||||||
|
@ -275,6 +285,14 @@ class Shared extends \OC\Files\Storage\Common {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function rename($path1, $path2) {
|
public function rename($path1, $path2) {
|
||||||
|
// Check for partial files
|
||||||
|
if (pathinfo($path1, PATHINFO_EXTENSION) === 'part') {
|
||||||
|
if ($oldSource = $this->getSourcePath($path1)) {
|
||||||
|
list($storage, $oldInternalPath) = \OC\Files\Filesystem::resolvePath($oldSource);
|
||||||
|
$newInternalPath = substr($oldInternalPath, 0, -5);
|
||||||
|
return $storage->rename($oldInternalPath, $newInternalPath);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
// Renaming/moving is only allowed within shared folders
|
// Renaming/moving is only allowed within shared folders
|
||||||
$pos1 = strpos($path1, '/', 1);
|
$pos1 = strpos($path1, '/', 1);
|
||||||
$pos2 = strpos($path2, '/', 1);
|
$pos2 = strpos($path2, '/', 1);
|
||||||
|
@ -306,6 +324,7 @@ class Shared extends \OC\Files\Storage\Common {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue