mirror of
https://github.com/nextcloud/server.git
synced 2026-06-11 01:30:50 -04:00
fix(files): Don't do session related work in the constructor of the View
Signed-off-by: Joas Schilling <coding@schilljs.com>
This commit is contained in:
parent
432d95e5d3
commit
259919e9fd
1 changed files with 10 additions and 10 deletions
|
|
@ -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\L10N\IFactory;
|
||||
use OCP\Lock\ILockingProvider;
|
||||
|
|
@ -61,7 +60,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
|
||||
|
|
@ -76,7 +75,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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -866,6 +865,7 @@ class View {
|
|||
$targetPath = $targetMount->getMountPoint();
|
||||
}
|
||||
|
||||
$l = $this->l10nFactory->get('files');
|
||||
foreach ($mounts as $mount) {
|
||||
$sourcePath = $this->getRelativePath($mount->getMountPoint());
|
||||
if ($sourcePath) {
|
||||
|
|
@ -875,29 +875,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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue