Skip to content

Commit

Permalink
fix(FileIndexer): Don't choke on missing files
Browse files Browse the repository at this point in the history
Fixes: #1448

Signed-off-by: Jonas <[email protected]>
  • Loading branch information
mejo- committed Aug 28, 2024
1 parent 06af111 commit 78cdc96
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions lib/Search/FileSearch/FileIndexer.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

use OCP\Files\File;
use OCP\Files\Folder;
use OCP\Files\GenericFileException;
use OCP\Files\InvalidPathException;
use OCP\Files\NotFoundException;
use OCP\Files\NotPermittedException;
Expand Down Expand Up @@ -84,11 +85,16 @@ public function run(array $pages = []): void {
try {
$id = $page->getId();
$internalPath = $page->getInternalPath();
$fileCollection = new Collection([
'id' => $id,
'name' => $page->getName(),
'content' => $page->getContent()
]);
try {
$fileCollection = new Collection([
'id' => $id,
'name' => $page->getName(),
'content' => $page->getContent()
]);
} catch (GenericFileException) {
// Ignore files that went missing
continue;
}
$this->processDocument($fileCollection);

$statement = $this->getIndex()->prepare("INSERT INTO filemap ( 'id', 'path') values ( :id, :path)");
Expand Down

0 comments on commit 78cdc96

Please sign in to comment.