Update the ebook URL validation error message

This commit is contained in:
Mike Colagrosso 2024-02-08 23:56:07 -07:00 committed by Alex Cabal
parent 3f091b0aa8
commit d6006528f2

View file

@ -507,12 +507,12 @@ class Artwork extends PropertiesBase{
$error->Add(new Exceptions\MissingPdProofException()); $error->Add(new Exceptions\MissingPdProofException());
} }
// Check the ebook www filesystem path. // Check the ebook URL.
// We don't check if it exists, because the book might not be published yet. // 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 // But we do a basic check that URL has the correct prefix and that it contains a slash between the author(s) and title.
if($this->EbookUrl !== null){ 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.')); $error->Add(new Exceptions\EbookNotFoundException('Invalid ebook URL. Check that it matches the URL in dc:identifier.'));
} }
} }