From c14fe4ff66d1046803d53fb102df91252b73bfee Mon Sep 17 00:00:00 2001 From: Kevin Lin Date: Sat, 27 Jan 2024 17:11:52 -0800 Subject: [PATCH] backend: Case-insensitive attachment extension matching for item photo inference --- 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: