Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion lib/Share/Helper/FilesMetadataCache.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

namespace OCA\Talk\Share\Helper;

use OCP\Files\IRootFolder;
use OCP\FilesMetadata\Exceptions\FilesMetadataNotFoundException;
use OCP\FilesMetadata\Exceptions\FilesMetadataTypeException;
use OCP\FilesMetadata\IFilesMetadataManager;
Expand All @@ -20,6 +21,7 @@ class FilesMetadataCache {

public function __construct(
private readonly IFilesMetadataManager $filesMetadataManager,
private readonly IRootFolder $rootFolder,
) {
}

Expand Down Expand Up @@ -47,7 +49,8 @@ public function preloadMetadata(array $fileIds): void {
public function getImageMetadataForFileId(int $fileId): array {
if (!array_key_exists($fileId, $this->filesSizeData)) {
try {
$this->cachePhotosSize($fileId, $this->filesMetadataManager->getMetadata($fileId, true));
$fileNode = $this->rootFolder->getFirstNodeById($fileId);
$this->cachePhotosSize($fileId, $this->filesMetadataManager->getMetadataForNode($fileNode));

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This breaks when the Nextcloud server was not updated. I outlined that in the issue?

Might be easier to simply add the problem to the psalm baseline

} catch (FilesMetadataNotFoundException) {
$this->filesSizeData[$fileId] = null;
}
Expand Down
Loading