Merge pull request #757 from sanmadjack/pull

Adjusted mime type update statement to include NULLs. Changed get_mim…
This commit is contained in:
Shish 2020-10-13 01:57:24 +01:00 committed by GitHub
commit 3c10d1cfee
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View file

@ -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;

View file

@ -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]
);
}