Skip to content

A continuation of HomeBox the inventory and organization system built for the Home User

fix: Case-insensitive attachment extension matching for item photo inference (#725)

LINKIWIca55e5ba94b5
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 c4ac672d..ae2782af 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: