Skip to content

Commit 7dccf5f

Browse files
committed
fix: give target file all permissions on copy
Signed-off-by: Robin Appelman <robin@icewind.nl>
1 parent 8417db5 commit 7dccf5f

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

lib/private/Files/Cache/Cache.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
use OC\Files\Search\SearchQuery;
1717
use OC\Files\Storage\Wrapper\Encryption;
1818
use OC\SystemConfig;
19+
use OCP\Constants;
1920
use OCP\DB\Exception;
2021
use OCP\DB\QueryBuilder\IQueryBuilder;
2122
use OCP\EventDispatcher\IEventDispatcher;
@@ -1224,6 +1225,12 @@ public function copyFromCache(ICache $sourceCache, ICacheEntry $sourceEntry, str
12241225
throw new \RuntimeException('Invalid source cache entry on copyFromCache');
12251226
}
12261227
$data = $this->cacheEntryToArray($sourceEntry);
1228+
// since we are essentially creating a new file, we don't have to obey the source permissions
1229+
if ($sourceEntry->getMimeType() === ICacheEntry::DIRECTORY_MIMETYPE) {
1230+
$data['permissions'] = Constants::PERMISSION_ALL;
1231+
} else {
1232+
$data['permissions'] = Constants::PERMISSION_ALL - Constants::PERMISSION_CREATE;
1233+
}
12271234

12281235
// when moving from an encrypted storage to a non-encrypted storage remove the `encrypted` mark
12291236
if ($sourceCache instanceof Cache

0 commit comments

Comments
 (0)