tw: do not attempt to index zero-byte files (close #933)

Signed-off-by: Varun Patil <radialapps@gmail.com>
pull/953/head
Varun Patil 2023-11-24 15:06:16 -08:00
parent eb784ef8ab
commit ff912a6bee
2 changed files with 3 additions and 1 deletions

View File

@ -44,7 +44,8 @@ class TimelineWrite
bool $force = false, bool $force = false,
): bool { ): bool {
// Check if we want to process this file // 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; return false;
} }

View File

@ -146,6 +146,7 @@ class Index
$query->select('f.fileid') $query->select('f.fileid')
->from('filecache', 'f') ->from('filecache', 'f')
->where($query->expr()->in('f.fileid', $query->createNamedParameter($fileIds, IQueryBuilder::PARAM_INT_ARRAY))) ->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 // Filter out files that are already indexed