1
0
mirror of https://github.com/pocket-id/pocket-id.git synced 2026-02-16 17:35:17 +00:00

fix: allow images with uppercase file extension

This commit is contained in:
Elias Schneider
2025-06-10 10:51:46 +02:00
parent 9700afb9cb
commit 1bcb50edc3
3 changed files with 4 additions and 5 deletions

View File

@@ -321,7 +321,7 @@ func (s *AppConfigService) ListAppConfig(showAll bool) []model.AppConfigVariable
} }
func (s *AppConfigService) UpdateImage(ctx context.Context, uploadedFile *multipart.FileHeader, imageName string, oldImageType string) (err error) { func (s *AppConfigService) UpdateImage(ctx context.Context, uploadedFile *multipart.FileHeader, imageName string, oldImageType string) (err error) {
fileType := utils.GetFileExtension(uploadedFile.Filename) fileType := strings.ToLower(utils.GetFileExtension(uploadedFile.Filename))
mimeType := utils.GetImageMimeType(fileType) mimeType := utils.GetImageMimeType(fileType)
if mimeType == "" { if mimeType == "" {
return &common.FileTypeNotSupportedError{} return &common.FileTypeNotSupportedError{}

View File

@@ -820,7 +820,7 @@ func (s *OidcService) GetClientLogo(ctx context.Context, clientID string) (strin
} }
func (s *OidcService) UpdateClientLogo(ctx context.Context, clientID string, file *multipart.FileHeader) error { func (s *OidcService) UpdateClientLogo(ctx context.Context, clientID string, file *multipart.FileHeader) error {
fileType := utils.GetFileExtension(file.Filename) fileType := strings.ToLower(utils.GetFileExtension(file.Filename))
if mimeType := utils.GetImageMimeType(fileType); mimeType == "" { if mimeType := utils.GetImageMimeType(fileType); mimeType == "" {
return &common.FileTypeNotSupportedError{} return &common.FileTypeNotSupportedError{}
} }

View File

@@ -3,13 +3,12 @@ package utils
import ( import (
"errors" "errors"
"fmt" "fmt"
"github.com/google/uuid"
"github.com/pocket-id/pocket-id/backend/resources"
"io" "io"
"mime/multipart" "mime/multipart"
"os" "os"
"path/filepath" "path/filepath"
"github.com/google/uuid"
"github.com/pocket-id/pocket-id/backend/resources"
) )
func GetFileExtension(filename string) string { func GetFileExtension(filename string) string {