diff --git a/lib/RssFeed.php b/lib/RssFeed.php index 136f6221..21143f48 100644 --- a/lib/RssFeed.php +++ b/lib/RssFeed.php @@ -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; } diff --git a/templates/RssEntry.php b/templates/RssEntry.php index 9862b61b..b0e27cbd 100644 --- a/templates/RssEntry.php +++ b/templates/RssEntry.php @@ -4,6 +4,13 @@ use function Safe\filesize; /** * @var Ebook $entry */ + +try{ + $filesize = @filesize(WEB_ROOT . $entry->EpubUrl); +} +catch(Safe\Exceptions\FilesystemException){ + $filesize = '0'; +} ?> <?= Formatter::EscapeXml($entry->Title) ?>, by <?= Formatter::EscapeXml(strip_tags($entry->AuthorsHtml)) ?> @@ -16,6 +23,6 @@ use function Safe\filesize; EpubUrl !== null){ ?> - is allowed */ ?> + is allowed */ ?>