Backend: Force file type "jpg" if mime type is "image/jpeg" #366

Signed-off-by: Michael Mayer <michael@liquidbytes.net>
This commit is contained in:
Michael Mayer 2020-06-29 17:25:52 +02:00
parent b8cb45b0de
commit 1cf3d19f45
3 changed files with 394 additions and 128 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

View file

@ -545,6 +545,10 @@ func (m *MediaFile) IsJson() bool {
// FileType returns the file type (jpg, gif, tiff,...). // FileType returns the file type (jpg, gif, tiff,...).
func (m *MediaFile) FileType() fs.FileType { func (m *MediaFile) FileType() fs.FileType {
if m.IsJpeg() {
return fs.TypeJpeg
}
return fs.GetFileType(m.fileName) return fs.GetFileType(m.fileName)
} }
@ -554,12 +558,12 @@ func (m *MediaFile) MediaType() fs.MediaType {
} }
// HasFileType returns true if this is the given type. // HasFileType returns true if this is the given type.
func (m *MediaFile) HasFileType(t fs.FileType) bool { func (m *MediaFile) HasFileType(fileType fs.FileType) bool {
if t == fs.TypeJpeg { if fileType == fs.TypeJpeg {
return m.IsJpeg() return m.IsJpeg()
} }
return m.FileType() == t return m.FileType() == fileType
} }
// IsRaw returns true if this is a RAW file. // IsRaw returns true if this is a RAW file.

File diff suppressed because it is too large Load diff