Skip to content

Commit

Permalink
tw: do not attempt to index zero-byte files (close #933)
Browse files Browse the repository at this point in the history
Signed-off-by: Varun Patil <[email protected]>
  • Loading branch information
pulsejet committed Nov 24, 2023
1 parent eb784ef commit ff912a6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/Db/TimelineWrite.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ public function processFile(
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;
}

Expand Down
1 change: 1 addition & 0 deletions lib/Service/Index.php
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ public function indexFolder(Folder $folder): void
$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
Expand Down

0 comments on commit ff912a6

Please sign in to comment.