From ca55e5ba94b52090c3de09e7ebb7849e00dc90c2 Mon Sep 17 00:00:00 2001 From: LINKIWI Date: Sat, 27 Jan 2024 19:28:58 -0800 Subject: [PATCH] fix: Case-insensitive attachment extension matching for item photo inference (#725) Former-commit-id: 3a6865079e68e9c1ee9beda651cbf123c58fcfc6 --- backend/app/api/handlers/v1/v1_ctrl_items_attachments.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/backend/app/api/handlers/v1/v1_ctrl_items_attachments.go b/backend/app/api/handlers/v1/v1_ctrl_items_attachments.go index c4ac672..ae2782a 100644 --- a/backend/app/api/handlers/v1/v1_ctrl_items_attachments.go +++ b/backend/app/api/handlers/v1/v1_ctrl_items_attachments.go @@ -4,6 +4,7 @@ import ( "errors" "net/http" "path/filepath" + "strings" "github.com/hay-kot/homebox/backend/internal/core/services" "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 ext := filepath.Ext(attachmentName) - switch ext { + switch strings.ToLower(ext) { case ".jpg", ".jpeg", ".png", ".webp", ".gif", ".bmp", ".tiff": attachmentType = attachment.TypePhoto.String() default: