1
0
mirror of https://github.com/pocket-id/pocket-id.git synced 2026-02-15 14:00:05 +00:00

fix: uploading a client logo with an URL fails (#1008)

This commit is contained in:
CzBiX
2025-10-06 23:37:43 +08:00
committed by GitHub
parent 29fc185376
commit 694f266dea

View File

@@ -15,6 +15,7 @@ import (
"net/http" "net/http"
"net/url" "net/url"
"os" "os"
"path/filepath"
"regexp" "regexp"
"slices" "slices"
"strings" "strings"
@@ -1937,12 +1938,13 @@ func (s *OidcService) downloadAndSaveLogoFromURL(parentCtx context.Context, tx *
return &common.FileTypeNotSupportedError{} return &common.FileTypeNotSupportedError{}
} }
imagePath := common.EnvConfig.UploadPath + "/oidc-client-images/" + clientID + "." + ext folderPath := filepath.Join(common.EnvConfig.UploadPath, "oidc-client-images")
err = os.MkdirAll(imagePath, os.ModePerm) err = os.MkdirAll(folderPath, os.ModePerm)
if err != nil { if err != nil {
return err return err
} }
imagePath := filepath.Join(folderPath, clientID+"."+ext)
err = utils.SaveFileStream(io.LimitReader(resp.Body, maxLogoSize+1), imagePath) err = utils.SaveFileStream(io.LimitReader(resp.Body, maxLogoSize+1), imagePath)
if err != nil { if err != nil {
return err return err