diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/files/storage/common.php | 7 | ||||
-rw-r--r-- | lib/private/files/storage/wrapper/quota.php | 27 | ||||
-rw-r--r-- | lib/public/appframework/http/redirectresponse.php | 2 |
3 files changed, 29 insertions, 7 deletions
diff --git a/lib/private/files/storage/common.php b/lib/private/files/storage/common.php index 3d5898dcd80..edc570c967d 100644 --- a/lib/private/files/storage/common.php +++ b/lib/private/files/storage/common.php @@ -72,6 +72,7 @@ abstract class Common implements Storage, ILockingStorage { protected $updater; protected $mountOptions = []; + protected $owner = null; public function __construct($parameters) { } @@ -383,7 +384,11 @@ abstract class Common implements Storage, ILockingStorage { * @return string|false uid or false */ public function getOwner($path) { - return \OC_User::getUser(); + if ($this->owner === null) { + $this->owner = \OC_User::getUser(); + } + + return $this->owner; } /** diff --git a/lib/private/files/storage/wrapper/quota.php b/lib/private/files/storage/wrapper/quota.php index 844505679df..500677b092e 100644 --- a/lib/private/files/storage/wrapper/quota.php +++ b/lib/private/files/storage/wrapper/quota.php @@ -141,17 +141,34 @@ class Quota extends Wrapper { */ public function fopen($path, $mode) { $source = $this->storage->fopen($path, $mode); - $free = $this->free_space(''); - if ($source && $free >= 0 && $mode !== 'r' && $mode !== 'rb') { - // only apply quota for files, not metadata, trash or others - if (strpos(ltrim($path, '/'), 'files/') === 0) { - return \OC\Files\Stream\Quota::wrap($source, $free); + + // don't apply quota for part files + if (!$this->isPartFile($path)) { + $free = $this->free_space(''); + if ($source && $free >= 0 && $mode !== 'r' && $mode !== 'rb') { + // only apply quota for files, not metadata, trash or others + if (strpos(ltrim($path, '/'), 'files/') === 0) { + return \OC\Files\Stream\Quota::wrap($source, $free); + } } } return $source; } /** + * Checks whether the given path is a part file + * + * @param string $path Path that may identify a .part file + * @return string File path without .part extension + * @note this is needed for reusing keys + */ + private function isPartFile($path) { + $extension = pathinfo($path, PATHINFO_EXTENSION); + + return ($extension === 'part'); + } + + /** * @param \OCP\Files\Storage $sourceStorage * @param string $sourceInternalPath * @param string $targetInternalPath diff --git a/lib/public/appframework/http/redirectresponse.php b/lib/public/appframework/http/redirectresponse.php index 7208012295f..bb0c8843715 100644 --- a/lib/public/appframework/http/redirectresponse.php +++ b/lib/public/appframework/http/redirectresponse.php @@ -44,7 +44,7 @@ class RedirectResponse extends Response { */ public function __construct($redirectURL) { $this->redirectURL = $redirectURL; - $this->setStatus(Http::STATUS_TEMPORARY_REDIRECT); + $this->setStatus(Http::STATUS_SEE_OTHER); $this->addHeader('Location', $redirectURL); } |