Просмотр исходного кода

Merge pull request #29115 from nextcloud/work/carl/correct-permissions-when-copying

Fix permissions when copying from ObjectStorage
tags/v23.0.0beta2
Carl Schwan 2 лет назад
Родитель
Сommit
df4e6bab69
Аккаунт пользователя с таким Email не найден
2 измененных файлов: 9 добавлений и 1 удалений
  1. 1
    1
      lib/private/Files/Cache/Cache.php
  2. 8
    0
      lib/private/Files/ObjectStore/ObjectStoreStorage.php

+ 1
- 1
lib/private/Files/Cache/Cache.php Просмотреть файл

* @param ICache $sourceCache * @param ICache $sourceCache
* @param ICacheEntry $sourceEntry * @param ICacheEntry $sourceEntry
* @param string $targetPath * @param string $targetPath
* @return int fileid of copied entry
* @return int fileId of copied entry
*/ */
public function copyFromCache(ICache $sourceCache, ICacheEntry $sourceEntry, string $targetPath): int { public function copyFromCache(ICache $sourceCache, ICacheEntry $sourceEntry, string $targetPath): int {
if ($sourceEntry->getId() < 0) { if ($sourceEntry->getId() < 0) {

+ 8
- 0
lib/private/Files/ObjectStore/ObjectStoreStorage.php Просмотреть файл

if ($sourceStorage->instanceOfStorage(ObjectStoreStorage::class)) { if ($sourceStorage->instanceOfStorage(ObjectStoreStorage::class)) {
/** @var ObjectStoreStorage $sourceStorage */ /** @var ObjectStoreStorage $sourceStorage */
if ($sourceStorage->getObjectStore()->getStorageId() === $this->getObjectStore()->getStorageId()) { if ($sourceStorage->getObjectStore()->getStorageId() === $this->getObjectStore()->getStorageId()) {
/** @var CacheEntry $sourceEntry */
$sourceEntry = $sourceStorage->getCache()->get($sourceInternalPath); $sourceEntry = $sourceStorage->getCache()->get($sourceInternalPath);
$sourceEntryData = $sourceEntry->getData();
// $sourceEntry['permissions'] here is the permissions from the jailed storage for the current
// user. Instead we use $sourceEntryData['scan_permissions'] that are the permissions from the
// unjailed storage.
if (is_array($sourceEntryData) && array_key_exists('scan_permissions', $sourceEntryData)) {
$sourceEntry['permissions'] = $sourceEntryData['scan_permissions'];
}
$this->copyInner($sourceEntry, $targetInternalPath); $this->copyInner($sourceEntry, $targetInternalPath);
return true; return true;
} }

Загрузка…
Отмена
Сохранить