Skip to content
Draft
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
1 change: 1 addition & 0 deletions apps/dav/lib/RootCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ public function __construct() {
Server::get(CleanupService::class),
$rootFolder,
$userSession,
$logger,
);
$uploadCollection->disableListing = $disableListing;

Expand Down
4 changes: 3 additions & 1 deletion apps/dav/lib/Upload/RootCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

use OCP\Files\IRootFolder;
use OCP\IUserSession;
use Psr\Log\LoggerInterface;
use Sabre\DAVACL\AbstractPrincipalCollection;
use Sabre\DAVACL\PrincipalBackend;

Expand All @@ -22,6 +23,7 @@ public function __construct(
private CleanupService $cleanupService,
private IRootFolder $rootFolder,
private IUserSession $userSession,
private LoggerInterface $logger,
) {
parent::__construct($principalBackend, $principalPrefix);
}
Expand All @@ -30,7 +32,7 @@ public function __construct(
* @inheritdoc
*/
public function getChildForPrincipal(array $principalInfo): UploadHome {
return new UploadHome($principalInfo, $this->cleanupService, $this->rootFolder, $this->userSession);
return new UploadHome($principalInfo, $this->cleanupService, $this->rootFolder, $this->userSession, $this->logger);
}

/**
Expand Down
9 changes: 9 additions & 0 deletions apps/dav/lib/Upload/UploadHome.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,12 @@

use OC\Files\View;
use OCA\DAV\Connector\Sabre\Directory;
use OCP\Constants;
use OCP\Files\Folder;
use OCP\Files\IRootFolder;
use OCP\Files\NotFoundException;
use OCP\IUserSession;
use Psr\Log\LoggerInterface;
use Sabre\DAV\Exception\Forbidden;
use Sabre\DAV\ICollection;

Expand All @@ -24,6 +26,7 @@ public function __construct(
private readonly CleanupService $cleanupService,
private readonly IRootFolder $rootFolder,
private readonly IUserSession $userSession,
private readonly LoggerInterface $logger,
) {
}

Expand Down Expand Up @@ -91,6 +94,12 @@ private function getUploadFolder(): Folder {

private function impl(): Directory {
$folder = $this->getUploadFolder();
if (!$folder->isCreatable()) {
$user = $this->userSession->getUser();
$this->logger->warning('Upload home not writable for ' . $user->getUID() . ', attempting to fix', ['permissions' => $folder->getPermissions()]);
$cache = $folder->getStorage()->getCache();
$cache->update($folder->getId(), ['permissions', Constants::PERMISSION_ALL]);
}
$view = new View($folder->getPath());
return new Directory($view, $folder);
}
Expand Down
Loading