Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Fix file permissions for SMB (read-only folders will be writeable)
  • Loading branch information
jvillafanez committed Jun 29, 2016
commit 51f6948fd11e0c92dcacd6edefeecd8da8527731
2 changes: 1 addition & 1 deletion apps/files_external/lib/Lib/Storage/SMB.php
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ public function isReadable($path) {
public function isUpdatable($path) {
try {
$info = $this->getFileInfo($path);
return !$info->isHidden() && !$info->isReadOnly();
return !$info->isHidden() && (!$info->isReadOnly() || $this->is_dir($path));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does readonly still work if the share itself is readonly ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Uploads will fail anywhere in the share if it's set as read-only. Anyway, I don't think we can't get the share configuration from the client.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems I'm able to stat the share directly, getting this from $this->share->getStat('') =>

  $result[0]                     = (int) '2094732529';
  $result[1]                     = (int) '-676439979';
  $result[2]                     = (int) '16877';
  $result[3]                     = (int) '2';
  $result[4]                     = (int) '30';
  $result[5]                     = (int) '8';
  $result[6]                     = (int) '0';
  $result[7]                     = (int) '0';
  $result[8]                     = (int) '1467378490';
  $result[9]                     = (int) '1466774556';
  $result[10]                    = (int) '1466774556';
  $result[11]                    = (int) '512';
  $result[12]                    = (int) '0';
  $result['dev']                 = (int) '2094732529';
  $result['ino']                 = (int) '-676439979';
  $result['mode']                = (int) '16877';
  $result['nlink']               = (int) '2';
  $result['uid']                 = (int) '30';
  $result['gid']                 = (int) '8';
  $result['rdev']                = (int) '0';
  $result['size']                = (int) '0';
  $result['atime']               = (int) '1467378490';
  $result['mtime']               = (int) '1466774556';
  $result['ctime']               = (int) '1466774556';
  $result['blksize']             = (int) '512';
  $result['blocks']              = (int) '0';

Not sure which is the permission.
But as I see on master we also don't handle share permissions, so might be something to do separately.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a quick comment here would be nice to avoid future devs to scratch their head trying to understand why we allow writing for read-only folders

} catch (NotFoundException $e) {
return false;
} catch (ForbiddenException $e) {
Expand Down