aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorDario Mehlich <d.mehlich@gmail.com>2025-01-27 10:16:08 +0100
committerbackportbot[bot] <backportbot[bot]@users.noreply.github.com>2025-01-27 15:11:26 +0000
commit72a43a17f557a04d7b925d159c9dfccd20f20fef (patch)
tree2e1d06bdc07240414477b4585f2613d987cc64d2 /lib
parent62a74d82644bf5a06fbd208f697c6000c1e6dcf0 (diff)
downloadnextcloud-server-72a43a17f557a04d7b925d159c9dfccd20f20fef.tar.gz
nextcloud-server-72a43a17f557a04d7b925d159c9dfccd20f20fef.zip
fix(preview): Filter for folders in cleanup old preview jobbackport/48581/stable31
Fixes #35936. When running `OC\Preview\BackgroundCleanupJob`, the main iteration loop in `run()` expects a folder, however, `getOldPreviewLocations()` currently does not filter by mimetype and therefore can yield a non-folder entry which causes an Exception when constructing the Folder impl. Filtering for `httpd/unix-directory`, as `getNewPreviewLocations()` already does, fixes this issue. Signed-off-by: Dario Mehlich <d.mehlich@gmail.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/private/Preview/BackgroundCleanupJob.php14
1 files changed, 7 insertions, 7 deletions
diff --git a/lib/private/Preview/BackgroundCleanupJob.php b/lib/private/Preview/BackgroundCleanupJob.php
index e816ae22743..3138abb1bf9 100644
--- a/lib/private/Preview/BackgroundCleanupJob.php
+++ b/lib/private/Preview/BackgroundCleanupJob.php
@@ -63,13 +63,13 @@ class BackgroundCleanupJob extends TimedJob {
$qb->expr()->castColumn('a.name', IQueryBuilder::PARAM_INT), 'b.fileid'
))
->where(
- $qb->expr()->isNull('b.fileid')
- )->andWhere(
- $qb->expr()->eq('a.storage', $qb->createNamedParameter($this->previewFolder->getStorageId()))
- )->andWhere(
- $qb->expr()->eq('a.parent', $qb->createNamedParameter($this->previewFolder->getId()))
- )->andWhere(
- $qb->expr()->like('a.name', $qb->createNamedParameter('__%'))
+ $qb->expr()->andX(
+ $qb->expr()->isNull('b.fileid'),
+ $qb->expr()->eq('a.storage', $qb->createNamedParameter($this->previewFolder->getStorageId())),
+ $qb->expr()->eq('a.parent', $qb->createNamedParameter($this->previewFolder->getId())),
+ $qb->expr()->like('a.name', $qb->createNamedParameter('__%')),
+ $qb->expr()->eq('a.mimetype', $qb->createNamedParameter($this->mimeTypeLoader->getId('httpd/unix-directory')))
+ )
);
if (!$this->isCLI) {