mirror of
https://github.com/nextcloud/server.git
synced 2026-04-12 20:47:04 -04:00
fix: target-repair: handle cases where the parent folder doesn't exist
Signed-off-by: Robin Appelman <robin@icewind.nl>
This commit is contained in:
parent
285decb94a
commit
b279fc0ed7
1 changed files with 7 additions and 1 deletions
|
|
@ -13,6 +13,7 @@ use OCA\Files_Sharing\ShareTargetValidator;
|
|||
use OCP\DB\QueryBuilder\IQueryBuilder;
|
||||
use OCP\Files\IRootFolder;
|
||||
use OCP\Files\Mount\IMountManager;
|
||||
use OCP\Files\NotFoundException;
|
||||
use OCP\IDBConnection;
|
||||
use OCP\IUserManager;
|
||||
use OCP\Migration\IOutput;
|
||||
|
|
@ -81,7 +82,12 @@ class CleanupShareTarget implements IRepairStep {
|
|||
$oldTarget = $shareInfo['file_target'];
|
||||
$newTarget = $this->cleanTarget($oldTarget);
|
||||
$absoluteNewTarget = $userFolder->getFullPath($newTarget);
|
||||
$targetParentNode = $this->rootFolder->get(dirname($absoluteNewTarget));
|
||||
try {
|
||||
$targetParentNode = $this->rootFolder->get(dirname($absoluteNewTarget));
|
||||
} catch (NotFoundException) {
|
||||
$absoluteNewTarget = $userFolder->getFullPath(basename($newTarget));
|
||||
$targetParentNode = $userFolder;
|
||||
}
|
||||
|
||||
try {
|
||||
$absoluteNewTarget = $this->shareTargetValidator->generateUniqueTarget(
|
||||
|
|
|
|||
Loading…
Reference in a new issue