aboutsummaryrefslogtreecommitdiffstats
path: root/lib/private/files
diff options
context:
space:
mode:
authorThomas Müller <thomas.mueller@tmit.eu>2016-03-07 15:07:31 +0100
committerThomas Müller <thomas.mueller@tmit.eu>2016-03-07 15:07:31 +0100
commit19dc02b8e0dceda97a83739b62fd8e4b67ac1b78 (patch)
tree29b162178661baa56a08ea61da46a00e181efb9e /lib/private/files
parenta61fa5b52675d0f1742c0dbe605df7a816ce1570 (diff)
parent89881ed5118f282bd3a93fe2dd092a296f17d2dc (diff)
downloadnextcloud-server-19dc02b8e0dceda97a83739b62fd8e4b67ac1b78.tar.gz
nextcloud-server-19dc02b8e0dceda97a83739b62fd8e4b67ac1b78.zip
Merge pull request #22900 from owncloud/diskfreespace-filesworkaround
Fix call to disk_free_space when a file is provided
Diffstat (limited to 'lib/private/files')
-rw-r--r--lib/private/files/storage/local.php10
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/private/files/storage/local.php b/lib/private/files/storage/local.php
index aa2b4628283..f6f5a8cc130 100644
--- a/lib/private/files/storage/local.php
+++ b/lib/private/files/storage/local.php
@@ -252,7 +252,15 @@ class Local extends \OC\Files\Storage\Common {
}
public function free_space($path) {
- $space = @disk_free_space($this->getSourcePath($path));
+ $sourcePath = $this->getSourcePath($path);
+ // using !is_dir because $sourcePath might be a part file or
+ // non-existing file, so we'd still want to use the parent dir
+ // in such cases
+ if (!is_dir($sourcePath)) {
+ // disk_free_space doesn't work on files
+ $sourcePath = dirname($sourcePath);
+ }
+ $space = @disk_free_space($sourcePath);
if ($space === false || is_null($space)) {
return \OCP\Files\FileInfo::SPACE_UNKNOWN;
}