Merge pull request #13886 from nextcloud/trashbin-original-location-fallback

add fallback for trashbin original location
This commit is contained in:
Roeland Jago Douma 2019-01-30 09:02:11 +01:00 committed by GitHub
commit 60ae0a4757
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

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,