mirror of
https://github.com/nextcloud/server.git
synced 2026-02-20 00:12:30 -05:00
Merge pull request #52665 from nextcloud/mountpoint-mkdir-quota
fix: create mountpoint folder even if the user has a quota of 0
This commit is contained in:
commit
e6bdfcd8ed
2 changed files with 19 additions and 0 deletions
|
|
@ -21,6 +21,7 @@ class Quota extends Wrapper {
|
|||
protected string $sizeRoot;
|
||||
private SystemConfig $config;
|
||||
private bool $quotaIncludeExternalStorage;
|
||||
private bool $enabled = true;
|
||||
|
||||
/**
|
||||
* @param array $parameters
|
||||
|
|
@ -46,6 +47,9 @@ class Quota extends Wrapper {
|
|||
}
|
||||
|
||||
private function hasQuota(): bool {
|
||||
if (!$this->enabled) {
|
||||
return false;
|
||||
}
|
||||
return $this->getQuota() !== FileInfo::SPACE_UNLIMITED;
|
||||
}
|
||||
|
||||
|
|
@ -197,4 +201,8 @@ class Quota extends Wrapper {
|
|||
|
||||
return parent::touch($path, $mtime);
|
||||
}
|
||||
|
||||
public function enableQuota(bool $enabled): void {
|
||||
$this->enabled = $enabled;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ namespace OC\Files;
|
|||
use Icewind\Streams\CallbackWrapper;
|
||||
use OC\Files\Mount\MoveableMount;
|
||||
use OC\Files\Storage\Storage;
|
||||
use OC\Files\Storage\Wrapper\Quota;
|
||||
use OC\Share\Share;
|
||||
use OC\User\LazyUser;
|
||||
use OC\User\Manager as UserManager;
|
||||
|
|
@ -1578,12 +1579,22 @@ class View {
|
|||
// Create parent folders if the mountpoint is inside a subfolder that doesn't exist yet
|
||||
if (!isset($files[$entryName])) {
|
||||
try {
|
||||
[$storage, ] = $this->resolvePath($path . '/' . $entryName);
|
||||
// make sure we can create the mountpoint folder, even if the user has a quota of 0
|
||||
if ($storage->instanceOfStorage(Quota::class)) {
|
||||
$storage->enableQuota(false);
|
||||
}
|
||||
|
||||
if ($this->mkdir($path . '/' . $entryName) !== false) {
|
||||
$info = $this->getFileInfo($path . '/' . $entryName);
|
||||
if ($info !== false) {
|
||||
$files[$entryName] = $info;
|
||||
}
|
||||
}
|
||||
|
||||
if ($storage->instanceOfStorage(Quota::class)) {
|
||||
$storage->enableQuota(true);
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
// Creating the parent folder might not be possible, for example due to a lack of permissions.
|
||||
$this->logger->debug('Failed to create non-existent parent', ['exception' => $e, 'path' => $path . '/' . $entryName]);
|
||||
|
|
|
|||
Loading…
Reference in a new issue