aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2025-03-05 08:59:32 +0100
committerJoas Schilling <coding@schilljs.com>2025-03-05 08:59:32 +0100
commitd7f7b7002aa6ecd4c6aa1374bedd3d7a0264495e (patch)
tree06764f1d138f65448beb178a9a9cbbe14cd6170c
parenta4760ef906ba897f19669898466bdb5c48703ec0 (diff)
downloadnextcloud-server-d7f7b7002aa6ecd4c6aa1374bedd3d7a0264495e.tar.gz
nextcloud-server-d7f7b7002aa6ecd4c6aa1374bedd3d7a0264495e.zip
fix(files): Don't do session related work in the constructor of the Viewbugfix/51248/no-session-work-in-constructor
Signed-off-by: Joas Schilling <coding@schilljs.com>
-rw-r--r--lib/private/Files/View.php19
1 files changed, 10 insertions, 9 deletions
diff --git a/lib/private/Files/View.php b/lib/private/Files/View.php
index fea1f64707b..4debb8703ad 100644
--- a/lib/private/Files/View.php
+++ b/lib/private/Files/View.php
@@ -62,7 +62,7 @@ class View {
private bool $updaterEnabled = true;
private UserManager $userManager;
private LoggerInterface $logger;
- private IL10N $l10n;
+ private IFactory $l10nFactory;
/**
* @throws \Exception If $root contains an invalid path
@@ -77,7 +77,7 @@ 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');
+ $this->l10nFactory = \OC::$server->get(IFactory::class);
}
/**
@@ -867,6 +867,7 @@ class View {
$targetPath = $targetMount->getMountPoint();
}
+ $l = $this->l10nFactory->get('files');
foreach ($mounts as $mount) {
$sourcePath = $this->getRelativePath($mount->getMountPoint());
if ($sourcePath) {
@@ -876,29 +877,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);
}
}
}