Skip to content
Snippets Groups Projects
Commit ffb55d5a authored by Michael Gapczynski's avatar Michael Gapczynski Committed by Jörn Friedrich Dreyer
Browse files

Don't return file handle if the mode supports writing and the file is not writable

Conflicts:
	apps/files_sharing/sharedstorage.php
parent 360c22fd
Branches
No related tags found
No related merge requests found
...@@ -416,6 +416,25 @@ class OC_Filestorage_Shared extends OC_Filestorage { ...@@ -416,6 +416,25 @@ class OC_Filestorage_Shared extends OC_Filestorage {
public function fopen($path, $mode) { public function fopen($path, $mode) {
$source = $this->getSource($path); $source = $this->getSource($path);
if ($source) { if ($source) {
switch ($mode) {
case 'r+':
case 'rb+':
case 'w+':
case 'wb+':
case 'x+':
case 'xb+':
case 'a+':
case 'ab+':
case 'w':
case 'wb':
case 'x':
case 'xb':
case 'a':
case 'ab':
if (!$this->is_writable($path)) {
return false;
}
}
$storage = OC_Filesystem::getStorage($source); $storage = OC_Filesystem::getStorage($source);
return $storage->fopen($this->getInternalPath($source), $mode); return $storage->fopen($this->getInternalPath($source), $mode);
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment