Merge pull request #24508 from nextcloud/backport/23257/stable19

[stable19] Fix file size computation on 32bit platforms
This commit is contained in:
Roeland Jago Douma 2020-12-02 19:51:10 +01:00 committed by GitHub
commit fb874e5d6d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 5 deletions

View File

@ -145,8 +145,8 @@ class Local extends \OC\Files\Storage\Common {
public function stat($path) { public function stat($path) {
$fullPath = $this->getSourcePath($path); $fullPath = $this->getSourcePath($path);
clearstatcache(true, $fullPath); clearstatcache(true, $fullPath);
$statResult = stat($fullPath); $statResult = @stat($fullPath);
if (PHP_INT_SIZE === 4 && !$this->is_dir($path)) { if (PHP_INT_SIZE === 4 && $statResult && !$this->is_dir($path)) {
$filesize = $this->filesize($path); $filesize = $this->filesize($path);
$statResult['size'] = $filesize; $statResult['size'] = $filesize;
$statResult[7] = $filesize; $statResult[7] = $filesize;
@ -158,9 +158,7 @@ class Local extends \OC\Files\Storage\Common {
* @inheritdoc * @inheritdoc
*/ */
public function getMetaData($path) { public function getMetaData($path) {
$fullPath = $this->getSourcePath($path); $stat = $this->stat($path);
clearstatcache(true, $fullPath);
$stat = @stat($fullPath);
if (!$stat) { if (!$stat) {
return null; return null;
} }
@ -179,6 +177,7 @@ class Local extends \OC\Files\Storage\Common {
} }
if (!($path === '' || $path === '/')) { // deletable depends on the parents unix permissions if (!($path === '' || $path === '/')) { // deletable depends on the parents unix permissions
$fullPath = $this->getSourcePath($path);
$parent = dirname($fullPath); $parent = dirname($fullPath);
if (is_writable($parent)) { if (is_writable($parent)) {
$permissions += Constants::PERMISSION_DELETE; $permissions += Constants::PERMISSION_DELETE;