add fallback for trashbin original location

Signed-off-by: Robin Appelman <robin@icewind.nl>
This commit is contained in:
Robin Appelman 2019-01-29 15:14:04 +01:00
parent 2767139ca9
commit 9a220214b8
No known key found for this signature in database
GPG key ID: 42B69D8A64526EFB

View file

@ -53,9 +53,13 @@ class LegacyTrashBackend implements ITrashBackend {
$parentTrashPath = ($parent instanceof ITrashItem) ? $parent->getTrashPath() : '';
$isRoot = $parent === null;
return array_map(function (FileInfo $file) use ($parent, $parentTrashPath, $isRoot, $user) {
$originalLocation = $isRoot ? $file['extraData'] : $parent->getOriginalLocation() . '/' . $file->getName();
if (!$originalLocation) {
$originalLocation = $file->getName();
}
return new TrashItem(
$this,
$isRoot ? $file['extraData'] : $parent->getOriginalLocation() . '/' . $file->getName(),
$originalLocation,
$file->getMTime(),
$parentTrashPath . '/' . $file->getName() . ($isRoot ? '.d' . $file->getMtime() : ''),
$file,