summaryrefslogtreecommitdiffstats
path: root/apps/dav/lib/connector/sabre/file.php
diff options
context:
space:
mode:
Diffstat (limited to 'apps/dav/lib/connector/sabre/file.php')
-rw-r--r--apps/dav/lib/connector/sabre/file.php17
1 files changed, 13 insertions, 4 deletions
diff --git a/apps/dav/lib/connector/sabre/file.php b/apps/dav/lib/connector/sabre/file.php
index 9c8344bc5db..7aa1693581e 100644
--- a/apps/dav/lib/connector/sabre/file.php
+++ b/apps/dav/lib/connector/sabre/file.php
@@ -112,7 +112,7 @@ class File extends Node implements IFile {
if ($needsPartFile) {
// mark file as partial while uploading (ignored by the scanner)
- $partFilePath = $this->path . '.ocTransferId' . rand() . '.part';
+ $partFilePath = $this->getPartFileBasePath($this->path) . '.ocTransferId' . rand() . '.part';
} else {
// upload file directly as the final path
$partFilePath = $this->path;
@@ -133,12 +133,12 @@ class File extends Node implements IFile {
list($count, $result) = \OC_Helper::streamCopy($data, $target);
fclose($target);
- if($result === false) {
+ if ($result === false) {
$expected = -1;
if (isset($_SERVER['CONTENT_LENGTH'])) {
$expected = $_SERVER['CONTENT_LENGTH'];
}
- throw new Exception('Error while copying file to target location (copied bytes: ' . $count . ', expected filesize: '. $expected .' )');
+ throw new Exception('Error while copying file to target location (copied bytes: ' . $count . ', expected filesize: ' . $expected . ' )');
}
// if content length is sent by client:
@@ -233,6 +233,15 @@ class File extends Node implements IFile {
return '"' . $this->info->getEtag() . '"';
}
+ private function getPartFileBasePath($path) {
+ $partFileInStorage = \OC::$server->getConfig()->getSystemValue('part_file_in_storage', true);
+ if ($partFileInStorage) {
+ return $path;
+ } else {
+ return md5($path); // will place it in the root of the view with a unique name
+ }
+ }
+
/**
* @param string $path
*/
@@ -420,7 +429,7 @@ class File extends Node implements IFile {
if ($needsPartFile) {
// we first assembly the target file as a part file
- $partFile = $path . '/' . $info['name'] . '.ocTransferId' . $info['transferid'] . '.part';
+ $partFile = $this->getPartFileBasePath($path . '/' . $info['name']) . '.ocTransferId' . $info['transferid'] . '.part';
/** @var \OC\Files\Storage\Storage $targetStorage */
list($partStorage, $partInternalPath) = $this->fileView->resolvePath($partFile);