Skip to content

Commit

Permalink
Do not pass '.' along as path
Browse files Browse the repository at this point in the history
Fixes #11637

When writing a file to the root of a shared storage we have to obtain
creatable information on the root of the share. However getting the
dirname of the path then results in '.'. Passing this along potentially
breaks.

For example objectstores do not have the same hierachy as a normal fs.
So the file '.' doesn't mean anything in that context.

Signed-off-by: Roeland Jago Douma <[email protected]>
  • Loading branch information
rullzer committed Oct 11, 2018
1 parent fe45db6 commit e1b7950
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions apps/files_sharing/lib/SharedStorage.php
Original file line number Diff line number Diff line change
Expand Up @@ -258,12 +258,16 @@ public function fopen($path, $mode) {
case 'xb':
case 'a':
case 'ab':
$creatable = $this->isCreatable(dirname($path));
$dirname = dirname($path);
if ($dirname === '.') {
$dirname = '';
}
$creatable = $this->isCreatable($dirname);
$updatable = $this->isUpdatable($path);
// if neither permissions given, no need to continue
if (!$creatable && !$updatable) {
if (pathinfo($path, PATHINFO_EXTENSION) === 'part') {
$updatable = $this->isUpdatable(dirname($path));
$updatable = $this->isUpdatable($dirname);
}

if (!$updatable) {
Expand Down

0 comments on commit e1b7950

Please sign in to comment.