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:
parent
b8cb45b0de
commit
1cf3d19f45
3 changed files with 394 additions and 128 deletions
BIN
assets/examples/this-is-a-jpeg.png
Normal file
BIN
assets/examples/this-is-a-jpeg.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 24 KiB |
|
@ -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
Loading…
Reference in a new issue