diff --git a/lib/Db/DbFileMapper.php b/lib/Db/DbFileMapper.php index edac9a6..636eb95 100644 --- a/lib/Db/DbFileMapper.php +++ b/lib/Db/DbFileMapper.php @@ -29,7 +29,7 @@ public function getFileIdsWithoutTags(array $excludedTagIds, int $limit, int $of $qb->select('f.fileid') ->from($this->getTableName(), 'f') - ->leftJoin('f', 'systemtag_object_mapping', 'o', $qb->expr()->eq('o.objectid', $qb->createFunction(sprintf('CAST(f.fileid AS %s)', $this->stringType)))) + ->leftJoin('f', 'systemtag_object_mapping', 'o', $qb->expr()->eq($qb->createFunction(sprintf('CAST(o.objectid as unsigned')) , 'f.fileid')) ->leftJoin('f', 'mimetypes', 'm', $qb->expr()->eq('f.mimetype', 'm.id')) ->where($qb->expr()->notIn('o.systemtagid', $qb->createNamedParameter($excludedTagIds, IQueryBuilder::PARAM_INT_ARRAY))) ->orWhere($qb->expr()->isNull('o.systemtagid')) @@ -68,7 +68,7 @@ public function getFileIdsWithTags(array $includedTagIds, int $limit, int $offse $qb->select('f.fileid') ->from($this->getTableName(), 'f') - ->leftJoin('f', 'systemtag_object_mapping', 'o', $qb->expr()->eq('o.objectid', $qb->createFunction(sprintf('CAST(f.fileid AS %s)', $this->stringType)))) + ->leftJoin('f', 'systemtag_object_mapping', 'o', $qb->expr()->eq($qb->createFunction(sprintf('CAST(o.objectid as unsigned')) , 'f.fileid')) ->leftJoin('f', 'mimetypes', 'm', $qb->expr()->eq('f.mimetype', 'm.id')) ->where($qb->expr()->in('o.systemtagid', $qb->createNamedParameter($includedTagIds, IQueryBuilder::PARAM_INT_ARRAY))) ->andWhere($qb->expr()->notLike('m.mimetype', $qb->createNamedParameter('%unix-directory%')))