mirror of
https://github.com/hay-kot/homebox.git
synced 2024-11-24 09:35:42 +00:00
fix: Case-insensitive attachment extension matching for item photo inference (#725)
Former-commit-id: 3a6865079e68e9c1ee9beda651cbf123c58fcfc6
This commit is contained in:
parent
7753213657
commit
ca55e5ba94
1 changed files with 2 additions and 1 deletions
|
@ -4,6 +4,7 @@ import (
|
||||||
"errors"
|
"errors"
|
||||||
"net/http"
|
"net/http"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
"strings"
|
||||||
|
|
||||||
"github.com/hay-kot/homebox/backend/internal/core/services"
|
"github.com/hay-kot/homebox/backend/internal/core/services"
|
||||||
"github.com/hay-kot/homebox/backend/internal/data/ent/attachment"
|
"github.com/hay-kot/homebox/backend/internal/data/ent/attachment"
|
||||||
|
@ -70,7 +71,7 @@ func (ctrl *V1Controller) HandleItemAttachmentCreate() errchain.HandlerFunc {
|
||||||
// Attempt to auto-detect the type of the file
|
// Attempt to auto-detect the type of the file
|
||||||
ext := filepath.Ext(attachmentName)
|
ext := filepath.Ext(attachmentName)
|
||||||
|
|
||||||
switch ext {
|
switch strings.ToLower(ext) {
|
||||||
case ".jpg", ".jpeg", ".png", ".webp", ".gif", ".bmp", ".tiff":
|
case ".jpg", ".jpeg", ".png", ".webp", ".gif", ".bmp", ".tiff":
|
||||||
attachmentType = attachment.TypePhoto.String()
|
attachmentType = attachment.TypePhoto.String()
|
||||||
default:
|
default:
|
||||||
|
|
Loading…
Reference in a new issue