Skip to content

Commit

Permalink
Merge pull request #24509 from nextcloud/backport/23257/stable20
Browse files Browse the repository at this point in the history
[stable20] Fix file size computation on 32bit platforms
  • Loading branch information
rullzer authored Dec 2, 2020
2 parents 4d68c61 + dc7eb53 commit bdbb60a
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions lib/private/Files/Storage/Local.php
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,8 @@ public function is_file($path) {
public function stat($path) {
$fullPath = $this->getSourcePath($path);
clearstatcache(true, $fullPath);
$statResult = stat($fullPath);
if (PHP_INT_SIZE === 4 && !$this->is_dir($path)) {
$statResult = @stat($fullPath);
if (PHP_INT_SIZE === 4 && $statResult && !$this->is_dir($path)) {
$filesize = $this->filesize($path);
$statResult['size'] = $filesize;
$statResult[7] = $filesize;
Expand All @@ -159,9 +159,7 @@ public function stat($path) {
* @inheritdoc
*/
public function getMetaData($path) {
$fullPath = $this->getSourcePath($path);
clearstatcache(true, $fullPath);
$stat = @stat($fullPath);
$stat = $this->stat($path);
if (!$stat) {
return null;
}
Expand All @@ -180,6 +178,7 @@ public function getMetaData($path) {
}

if (!($path === '' || $path === '/')) { // deletable depends on the parents unix permissions
$fullPath = $this->getSourcePath($path);
$parent = dirname($fullPath);
if (is_writable($parent)) {
$permissions += Constants::PERMISSION_DELETE;
Expand Down

0 comments on commit bdbb60a

Please sign in to comment.