Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions lib/private/Files/Storage/Wrapper/Quota.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ class Quota extends Wrapper {
protected string $sizeRoot;
private SystemConfig $config;
private bool $quotaIncludeExternalStorage;
private bool $enabled = true;

/**
* @param array $parameters
Expand All @@ -46,6 +47,9 @@ public function getQuota(): int|float {
}

private function hasQuota(): bool {
if (!$this->enabled) {
return false;
}
return $this->getQuota() !== FileInfo::SPACE_UNLIMITED;
}

Expand Down Expand Up @@ -197,4 +201,8 @@ public function touch(string $path, ?int $mtime = null): bool {

return parent::touch($path, $mtime);
}

public function enableQuota(bool $enabled): void {
$this->enabled = $enabled;
}
}
11 changes: 11 additions & 0 deletions lib/private/Files/View.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
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;
Expand Down Expand Up @@ -1579,12 +1580,22 @@ public function getDirectoryContent($directory, $mimetype_filter = '', ?\OCP\Fil
// 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]);
Expand Down
Loading