mirror of
https://github.com/standardebooks/web.git
synced 2025-07-15 10:56:46 -04:00
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.
This commit is contained in:
parent
27a83da463
commit
7d6d04f7ca
1 changed files with 1 additions and 3 deletions
|
@ -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();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue