From ff912a6bee0f944296d9d6fede28cfd26659f807 Mon Sep 17 00:00:00 2001 From: Varun Patil Date: Fri, 24 Nov 2023 15:06:16 -0800 Subject: [PATCH] tw: do not attempt to index zero-byte files (close #933) Signed-off-by: Varun Patil --- lib/Db/TimelineWrite.php | 3 ++- lib/Service/Index.php | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/Db/TimelineWrite.php b/lib/Db/TimelineWrite.php index b57be324..598049ff 100644 --- a/lib/Db/TimelineWrite.php +++ b/lib/Db/TimelineWrite.php @@ -44,7 +44,8 @@ class TimelineWrite bool $force = false, ): bool { // Check if we want to process this file - if (!Index::isSupported($file)) { + // https://github.com/pulsejet/memories/issues/933 (zero-byte files) + if ($file->getSize() <= 0 || !Index::isSupported($file)) { return false; } diff --git a/lib/Service/Index.php b/lib/Service/Index.php index 91f1ee25..6c337c6b 100644 --- a/lib/Service/Index.php +++ b/lib/Service/Index.php @@ -146,6 +146,7 @@ class Index $query->select('f.fileid') ->from('filecache', 'f') ->where($query->expr()->in('f.fileid', $query->createNamedParameter($fileIds, IQueryBuilder::PARAM_INT_ARRAY))) + ->andWhere($query->expr()->gt('f.size', $query->expr()->literal(0))) ; // Filter out files that are already indexed