From 7d6d04f7ca29d2ff4528c8938fccb05b20ea6142 Mon Sep 17 00:00:00 2001 From: Mike Colagrosso Date: Sun, 15 Dec 2024 16:53:23 -0700 Subject: [PATCH] Allow author paths that don't point to www files Authors with placeholders only, e.g. (at the time of writing): https://standardebooks.org/ebooks/dashiell-hammet were returning 404s because there was no directory at /standardebooks.org/web/www/ebooks/dashiell-hammet Now we allow calls to `Ebook::GetAllByAuthor()` for such URLs because it might find placeholders for the author. --- www/authors/get.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/www/authors/get.php b/www/authors/get.php index 7fb4a110..77c2c701 100644 --- a/www/authors/get.php +++ b/www/authors/get.php @@ -5,10 +5,8 @@ $authorUrl = ''; try{ $urlPath = trim(str_replace('.', '', HttpInput::Str(GET, 'url-path') ?? ''), '/'); // Contains the portion of the URL (without query string) that comes after `https://standardebooks.org/ebooks/`. - $wwwFilesystemPath = EBOOKS_DIST_PATH . $urlPath; // Path to the deployed www files for this ebook. - if($urlPath == '' || mb_stripos($wwwFilesystemPath, EBOOKS_DIST_PATH) !== 0 || !is_dir($wwwFilesystemPath)){ - // Ensure the path exists and that the root is in our www directory. + if($urlPath == ''){ throw new Exceptions\AuthorNotFoundException(); }