Adjusted mime type update statement to include NULLs. Changed get_mime() so that it can return a null in the event of the mime type not being properly set.
This commit is contained in:
parent
547c6d98da
commit
bf2a34c106
2 changed files with 2 additions and 2 deletions
|
@ -598,7 +598,7 @@ class Image
|
|||
/**
|
||||
* Get the image's mime type.
|
||||
*/
|
||||
public function get_mime(): string
|
||||
public function get_mime(): ?string
|
||||
{
|
||||
if ($this->mime===MimeType::WEBP&&$this->lossless) {
|
||||
return MimeType::WEBP_LOSSLESS;
|
||||
|
|
|
@ -45,7 +45,7 @@ class MimeSystem extends Extension
|
|||
$normalized_extension = FileExtension::get_for_mime($mime);
|
||||
|
||||
$database->execute(
|
||||
"UPDATE images SET mime = :mime, ext = :new_ext WHERE ext = :ext AND (mime != :mime OR ext != :new_ext)",
|
||||
"UPDATE images SET mime = :mime, ext = :new_ext WHERE ext = :ext AND (mime IS NULL OR mime != :mime OR ext != :new_ext)",
|
||||
["mime" => $mime, "new_ext" => $normalized_extension, "ext" => $ext]
|
||||
);
|
||||
}
|
||||
|
|
Reference in a new issue