Fix validation of existing artwork name when creating a new artwork

This commit is contained in:
Alex Cabal 2025-01-24 09:37:13 -06:00
parent 4bec47a389
commit 59083baf8c

View file

@ -509,18 +509,15 @@ class Artwork{
}
// Check for existing `Artwork` objects with the same URL but different `ArtworkID`s.
if(isset($this->ArtworkId)){
try{
$existingArtwork = Artwork::GetByUrl($this->Artist->UrlName, $this->UrlName);
if($existingArtwork->ArtworkId != $this->ArtworkId){
// Duplicate found, alert the user.
if(!isset($this->ArtworkId) || $existingArtwork->ArtworkId != $this->ArtworkId){
$error->Add(new Exceptions\ArtworkAlreadyExistsException());
}
}
catch(Exceptions\ArtworkNotFoundException){
// No duplicates found, continue.
}
}
if($isImageRequired){
if($imagePath === null){