Catch exceptions if files don't exist

This commit is contained in:
Alex Cabal 2025-04-14 10:46:54 -05:00
parent 3a2778cd77
commit 8c81e5b9d2
2 changed files with 15 additions and 2 deletions

View file

@ -48,7 +48,13 @@ class RssFeed extends Feed{
foreach($this->Entries as $entry){
/** @var Ebook $entry */
$obj = new stdClass();
$obj->Size = (string)filesize(WEB_ROOT . $entry->EpubUrl);
try{
// Safe can still emit a warning if the file isn't found, silence that here.
$obj->Size = @(string)filesize(WEB_ROOT . $entry->EpubUrl);
}
catch(Safe\Exceptions\FilesystemException){
$obj->Size = '0';
}
$obj->Id = $entry->FullUrl;
$currentEntries[] = $obj;
}