|
19 | 19 | use OCA\DAV\CalDAV\Trashbin\TrashbinHome; |
20 | 20 | use OCA\DAV\Connector\Sabre\Directory; |
21 | 21 | use OCA\DAV\Db\PropertyMapper; |
| 22 | +use OCA\DAV\Connector\Sabre\FilesPlugin; |
| 23 | +use OCA\Files_Trashbin\Sabre\TrashRoot; |
22 | 24 | use OCP\DB\QueryBuilder\IQueryBuilder; |
| 25 | +use OCP\Files\Folder; |
23 | 26 | use OCP\IDBConnection; |
24 | 27 | use OCP\IUser; |
25 | 28 | use Override; |
@@ -208,8 +211,13 @@ public function propFind($path, PropFind $propFind): void { |
208 | 211 | } |
209 | 212 |
|
210 | 213 | $node = $this->tree->getNodeForPath($path); |
211 | | - if ($node instanceof Directory && $propFind->getDepth() !== 0) { |
212 | | - $this->cacheDirectory($path, $node); |
| 214 | + if (($node instanceof Directory) && $propFind->getDepth() !== 0) { |
| 215 | + $this->cacheDirectory($path, $node->getNode()); |
| 216 | + } else if ($node instanceof TrashRoot) { |
| 217 | + $trashNodes = $node->getTrashRoots(); |
| 218 | + foreach ($trashNodes as $trashNode) { |
| 219 | + $this->cacheDirectory($path, $trashNode); |
| 220 | + } |
213 | 221 | } |
214 | 222 |
|
215 | 223 | if ($node instanceof CalendarHome && $propFind->getDepth() !== 0) { |
@@ -356,18 +364,17 @@ private function getPublishedProperties(string $path, array $requestedProperties |
356 | 364 | /** |
357 | 365 | * Prefetch all user properties in a directory |
358 | 366 | */ |
359 | | - private function cacheDirectory(string $path, Directory $node): void { |
| 367 | + private function cacheDirectory(string $path, Folder $node): void { |
360 | 368 | $prefix = ltrim($path . '/', '/'); |
361 | 369 | $query = $this->connection->getQueryBuilder(); |
362 | 370 | $query->select('name', 'p.propertypath', 'p.propertyname', 'p.propertyvalue', 'p.valuetype') |
363 | 371 | ->from('filecache', 'f') |
364 | | - ->hintShardKey('storage', $node->getNode()->getMountPoint()->getNumericStorageId()) |
| 372 | + ->hintShardKey('storage', $node->getMountPoint()->getNumericStorageId()) |
365 | 373 | ->leftJoin('f', 'properties', 'p', $query->expr()->eq('p.propertypath', $query->func()->concat( |
366 | 374 | $query->createNamedParameter($prefix), |
367 | 375 | 'f.name' |
368 | | - )), |
369 | | - ) |
370 | | - ->where($query->expr()->eq('parent', $query->createNamedParameter($node->getInternalFileId(), IQueryBuilder::PARAM_INT))) |
| 376 | + ))) |
| 377 | + ->where($query->expr()->eq('parent', $query->createNamedParameter($node->getId(), IQueryBuilder::PARAM_INT))) |
371 | 378 | ->andWhere($query->expr()->orX( |
372 | 379 | $query->expr()->eq('p.userid', $query->createNamedParameter($this->user->getUID())), |
373 | 380 | $query->expr()->isNull('p.userid'), |
|
0 commit comments