Support fileid propfind on trash endpoint
Fixes #9416 In order to support previews on mobile clients they will need the fileid of files in the trashbin. Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
This commit is contained in:
parent
8d17d7f6cd
commit
5eb72a8a57
|
@ -62,7 +62,6 @@ class Helper {
|
||||||
$dirContent = $storage->getCache()->getFolderContents($mount->getInternalPath($view->getAbsolutePath($dir)));
|
$dirContent = $storage->getCache()->getFolderContents($mount->getInternalPath($view->getAbsolutePath($dir)));
|
||||||
foreach ($dirContent as $entry) {
|
foreach ($dirContent as $entry) {
|
||||||
$entryName = $entry->getName();
|
$entryName = $entry->getName();
|
||||||
$id = $entry->getId();
|
|
||||||
$name = $entryName;
|
$name = $entryName;
|
||||||
if ($dir === '' || $dir === '/') {
|
if ($dir === '' || $dir === '/') {
|
||||||
$pathparts = pathinfo($entryName);
|
$pathparts = pathinfo($entryName);
|
||||||
|
@ -91,7 +90,8 @@ class Helper {
|
||||||
'directory' => ($dir === '/') ? '' : $dir,
|
'directory' => ($dir === '/') ? '' : $dir,
|
||||||
'size' => $entry->getSize(),
|
'size' => $entry->getSize(),
|
||||||
'etag' => '',
|
'etag' => '',
|
||||||
'permissions' => Constants::PERMISSION_ALL - Constants::PERMISSION_SHARE
|
'permissions' => Constants::PERMISSION_ALL - Constants::PERMISSION_SHARE,
|
||||||
|
'fileid' => $entry->getId(),
|
||||||
);
|
);
|
||||||
if ($originalPath) {
|
if ($originalPath) {
|
||||||
if ($originalPath !== '.') {
|
if ($originalPath !== '.') {
|
||||||
|
|
|
@ -33,4 +33,6 @@ interface ITrash {
|
||||||
public function getDeletionTime(): int;
|
public function getDeletionTime(): int;
|
||||||
|
|
||||||
public function getSize();
|
public function getSize();
|
||||||
|
|
||||||
|
public function getFileId(): int;
|
||||||
}
|
}
|
||||||
|
|
|
@ -69,6 +69,10 @@ class PropfindPlugin extends ServerPlugin {
|
||||||
$propFind->handle(FilesPlugin::SIZE_PROPERTYNAME, function () use ($node) {
|
$propFind->handle(FilesPlugin::SIZE_PROPERTYNAME, function () use ($node) {
|
||||||
return $node->getSize();
|
return $node->getSize();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$propFind->handle(FilesPlugin::FILEID_PROPERTYNAME, function () use ($node) {
|
||||||
|
return $node->getFileId();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -90,4 +90,10 @@ class TrashFile implements IFile, ITrash {
|
||||||
public function getDeletionTime(): int {
|
public function getDeletionTime(): int {
|
||||||
return $this->getLastModified();
|
return $this->getLastModified();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getFileId(): int {
|
||||||
|
return $this->data->getId();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -123,4 +123,8 @@ class TrashFolder implements ICollection, ITrash {
|
||||||
public function getSize(): int {
|
public function getSize(): int {
|
||||||
return $this->data->getSize();
|
return $this->data->getSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getFileId(): int {
|
||||||
|
return $this->data->getId();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -101,4 +101,8 @@ class TrashFolderFile implements IFile, ITrash {
|
||||||
public function getDeletionTime(): int {
|
public function getDeletionTime(): int {
|
||||||
return $this->getLastModified();
|
return $this->getLastModified();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getFileId(): int {
|
||||||
|
return $this->data->getId();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -136,4 +136,8 @@ class TrashFolderFolder implements ICollection, ITrash {
|
||||||
public function getSize(): int {
|
public function getSize(): int {
|
||||||
return $this->data->getSize();
|
return $this->data->getSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getFileId(): int {
|
||||||
|
return $this->data->getId();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue