Skip to content

Commit aae231d

Browse files
jvillafanezVincent Petry
authored andcommitted
Fix file permissions for SMB (read-only folders will be writeable)
Read-only folders won't be deletable
1 parent 2f08c6c commit aae231d

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

apps/files_external/lib/smb.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -361,6 +361,19 @@ public function isReadable($path) {
361361
}
362362

363363
public function isUpdatable($path) {
364+
try {
365+
$info = $this->getFileInfo($path);
366+
// following windows behaviour for read-only folders: they can be written into
367+
// (https://support.microsoft.com/en-us/kb/326549 - "cause" section)
368+
return !$info->isHidden() && (!$info->isReadOnly() || $this->is_dir($path));
369+
} catch (NotFoundException $e) {
370+
return false;
371+
} catch (ForbiddenException $e) {
372+
return false;
373+
}
374+
}
375+
376+
public function isDeletable($path) {
364377
try {
365378
$info = $this->getFileInfo($path);
366379
return !$info->isHidden() && !$info->isReadOnly();

0 commit comments

Comments
 (0)