Fix artwork validation logic

This commit is contained in:
Alex Cabal 2024-06-03 13:11:13 -05:00
parent 78f31ceb6b
commit c51fe594bf
2 changed files with 6 additions and 2 deletions

View file

@ -509,8 +509,8 @@ class Artwork{
}
}
if($this->MimeType === null && !$error->Has('Exceptions\InvalidImageUploadException')){
// Only notify of wrong mimetype if there is no other problem with the uploaded image
if($imagePath !== null && $this->MimeType === null && !$error->Has('Exceptions\InvalidImageUploadException')){
// Only notify of wrong mimetype if there are no other problem with the uploaded image
$error->Add(new Exceptions\InvalidMimeTypeException());
}

View file

@ -68,6 +68,10 @@ try{
$artwork->Status = $newStatus;
}
if(HttpInput::File('artwork-image') === null){
$artwork->MimeType = $originalArtwork->MimeType;
}
$artwork->Save(HttpInput::File('artwork-image'));
$_SESSION['artwork'] = $artwork;