fix: give target file all permissions on copy

Signed-off-by: Robin Appelman <robin@icewind.nl>
This commit is contained in:
Robin Appelman 2025-06-30 18:15:08 +02:00
parent 8417db5df8
commit 7dccf5f257
No known key found for this signature in database
GPG key ID: 42B69D8A64526EFB

View file

@ -16,6 +16,7 @@ use OC\Files\Search\SearchComparison;
use OC\Files\Search\SearchQuery;
use OC\Files\Storage\Wrapper\Encryption;
use OC\SystemConfig;
use OCP\Constants;
use OCP\DB\Exception;
use OCP\DB\QueryBuilder\IQueryBuilder;
use OCP\EventDispatcher\IEventDispatcher;
@ -1224,6 +1225,12 @@ class Cache implements ICache {
throw new \RuntimeException('Invalid source cache entry on copyFromCache');
}
$data = $this->cacheEntryToArray($sourceEntry);
// since we are essentially creating a new file, we don't have to obey the source permissions
if ($sourceEntry->getMimeType() === ICacheEntry::DIRECTORY_MIMETYPE) {
$data['permissions'] = Constants::PERMISSION_ALL;
} else {
$data['permissions'] = Constants::PERMISSION_ALL - Constants::PERMISSION_CREATE;
}
// when moving from an encrypted storage to a non-encrypted storage remove the `encrypted` mark
if ($sourceCache instanceof Cache