diff --git a/core/imageboard/image.php b/core/imageboard/image.php index b65dc8ef..5d0e33c5 100644 --- a/core/imageboard/image.php +++ b/core/imageboard/image.php @@ -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; diff --git a/ext/mime/main.php b/ext/mime/main.php index bcbccdde..c98adde5 100644 --- a/ext/mime/main.php +++ b/ext/mime/main.php @@ -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] ); }