Add special 'query-ebook-url' parameter to /artworks to get covers matching exactly the ebook URL

This commit is contained in:
Alex Cabal 2024-01-26 12:05:27 -06:00
parent 3ebe6fe457
commit 801b5f524a
2 changed files with 9 additions and 2 deletions

View file

@ -501,7 +501,7 @@ class Artwork extends PropertiesBase{
// We don't check if it exists, because the book might not be published yet.
// But we do a basic check that the string includes one _. It might not include a dash, for example anonymous_poetry
if($this->EbookUrl !== null){
if(!preg_match('|^https://standardebooks.org/ebooks/|ius', $this->EbookUrl)){
if(!preg_match('|^https://standardebooks.org/ebooks/[^/]+?/[^/]+?|ius', $this->EbookUrl)){
$error->Add(new Exceptions\EbookNotFoundException('Invalid ebook. Expected S.E. URL.'));
}
}