Skip to content
This repository has been archived by the owner on Jun 12, 2024. It is now read-only.

Commit

Permalink
fix: Case-insensitive attachment extension matching for item photo in…
Browse files Browse the repository at this point in the history
…ference (#725)

Former-commit-id: 3a68650
  • Loading branch information
LINKIWI authored Jan 28, 2024
1 parent 7753213 commit ca55e5b
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion backend/app/api/handlers/v1/v1_ctrl_items_attachments.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit ca55e5b

Please sign in to comment.