From 694f266dea0e7913468be519b7e60033d3daf30b Mon Sep 17 00:00:00 2001 From: CzBiX Date: Mon, 6 Oct 2025 23:37:43 +0800 Subject: [PATCH] fix: uploading a client logo with an URL fails (#1008) --- backend/internal/service/oidc_service.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/backend/internal/service/oidc_service.go b/backend/internal/service/oidc_service.go index 6e6bba7f..79edc398 100644 --- a/backend/internal/service/oidc_service.go +++ b/backend/internal/service/oidc_service.go @@ -15,6 +15,7 @@ import ( "net/http" "net/url" "os" + "path/filepath" "regexp" "slices" "strings" @@ -1937,12 +1938,13 @@ func (s *OidcService) downloadAndSaveLogoFromURL(parentCtx context.Context, tx * return &common.FileTypeNotSupportedError{} } - imagePath := common.EnvConfig.UploadPath + "/oidc-client-images/" + clientID + "." + ext - err = os.MkdirAll(imagePath, os.ModePerm) + folderPath := filepath.Join(common.EnvConfig.UploadPath, "oidc-client-images") + err = os.MkdirAll(folderPath, os.ModePerm) if err != nil { return err } + imagePath := filepath.Join(folderPath, clientID+"."+ext) err = utils.SaveFileStream(io.LimitReader(resp.Body, maxLogoSize+1), imagePath) if err != nil { return err