aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKate <26026535+provokateurin@users.noreply.github.com>2025-03-05 16:32:21 +0100
committerGitHub <noreply@github.com>2025-03-05 16:32:21 +0100
commitc93eda7b6f2056cdb8607cda76c722d568bbeac1 (patch)
treef7c196048f70c9efa0b00d4945caf03d77508a72
parentcc257ecf925214e4baf8faafa8bec5485e5d4111 (diff)
parent44e89610edf70b7f88bf4ac7c9bf2fec2a9a7bc3 (diff)
downloadnextcloud-server-c93eda7b6f2056cdb8607cda76c722d568bbeac1.tar.gz
nextcloud-server-c93eda7b6f2056cdb8607cda76c722d568bbeac1.zip
Merge pull request #51276 from nextcloud/backport/51259/stable31
[stable31] fix(files): Don't do session related work in the constructor of the View
-rw-r--r--lib/private/Files/View.php18
1 files changed, 8 insertions, 10 deletions
diff --git a/lib/private/Files/View.php b/lib/private/Files/View.php
index fea1f64707b..bbad24d3e43 100644
--- a/lib/private/Files/View.php
+++ b/lib/private/Files/View.php
@@ -28,7 +28,6 @@ use OCP\Files\Mount\IMountManager;
use OCP\Files\Mount\IMountPoint;
use OCP\Files\NotFoundException;
use OCP\Files\ReservedWordException;
-use OCP\IL10N;
use OCP\IUser;
use OCP\IUserManager;
use OCP\L10N\IFactory;
@@ -62,7 +61,6 @@ class View {
private bool $updaterEnabled = true;
private UserManager $userManager;
private LoggerInterface $logger;
- private IL10N $l10n;
/**
* @throws \Exception If $root contains an invalid path
@@ -77,7 +75,6 @@ class View {
$this->lockingEnabled = !($this->lockingProvider instanceof \OC\Lock\NoopLockingProvider);
$this->userManager = \OC::$server->getUserManager();
$this->logger = \OC::$server->get(LoggerInterface::class);
- $this->l10n = \OC::$server->get(IFactory::class)->get('files');
}
/**
@@ -867,6 +864,7 @@ class View {
$targetPath = $targetMount->getMountPoint();
}
+ $l = \OC::$server->get(IFactory::class)->get('files');
foreach ($mounts as $mount) {
$sourcePath = $this->getRelativePath($mount->getMountPoint());
if ($sourcePath) {
@@ -876,29 +874,29 @@ class View {
}
if (!$mount instanceof MoveableMount) {
- throw new ForbiddenException($this->l10n->t('Storage %s cannot be moved', [$sourcePath]), false);
+ throw new ForbiddenException($l->t('Storage %s cannot be moved', [$sourcePath]), false);
}
if ($targetIsShared) {
if ($sourceMount instanceof SharedMount) {
- throw new ForbiddenException($this->l10n->t('Moving a share (%s) into a shared folder is not allowed', [$sourcePath]), false);
+ throw new ForbiddenException($l->t('Moving a share (%s) into a shared folder is not allowed', [$sourcePath]), false);
} else {
- throw new ForbiddenException($this->l10n->t('Moving a storage (%s) into a shared folder is not allowed', [$sourcePath]), false);
+ throw new ForbiddenException($l->t('Moving a storage (%s) into a shared folder is not allowed', [$sourcePath]), false);
}
}
if ($sourceMount !== $targetMount) {
if ($sourceMount instanceof SharedMount) {
if ($targetMount instanceof SharedMount) {
- throw new ForbiddenException($this->l10n->t('Moving a share (%s) into another share (%s) is not allowed', [$sourcePath, $targetPath]), false);
+ throw new ForbiddenException($l->t('Moving a share (%s) into another share (%s) is not allowed', [$sourcePath, $targetPath]), false);
} else {
- throw new ForbiddenException($this->l10n->t('Moving a share (%s) into another storage (%s) is not allowed', [$sourcePath, $targetPath]), false);
+ throw new ForbiddenException($l->t('Moving a share (%s) into another storage (%s) is not allowed', [$sourcePath, $targetPath]), false);
}
} else {
if ($targetMount instanceof SharedMount) {
- throw new ForbiddenException($this->l10n->t('Moving a storage (%s) into a share (%s) is not allowed', [$sourcePath, $targetPath]), false);
+ throw new ForbiddenException($l->t('Moving a storage (%s) into a share (%s) is not allowed', [$sourcePath, $targetPath]), false);
} else {
- throw new ForbiddenException($this->l10n->t('Moving a storage (%s) into another storage (%s) is not allowed', [$sourcePath, $targetPath]), false);
+ throw new ForbiddenException($l->t('Moving a storage (%s) into another storage (%s) is not allowed', [$sourcePath, $targetPath]), false);
}
}
}