1
0
mirror of https://github.com/pocket-id/pocket-id.git synced 2026-03-22 15:00:07 +00:00

fix: avoid fmt.Sprintf on custom GeoLiteDBUrl without %s placeholder (#1384)

This commit is contained in:
Chotow
2026-03-18 20:41:14 +08:00
committed by GitHub
parent 0c039cc88c
commit 95e9af4bbf

View File

@@ -14,6 +14,7 @@ import (
"net/netip" "net/netip"
"os" "os"
"path/filepath" "path/filepath"
"strings"
"sync" "sync"
"time" "time"
@@ -112,7 +113,11 @@ func (s *GeoLiteService) UpdateDatabase(parentCtx context.Context) error {
} }
slog.Info("Updating GeoLite2 City database") slog.Info("Updating GeoLite2 City database")
downloadUrl := fmt.Sprintf(common.EnvConfig.GeoLiteDBUrl, common.EnvConfig.MaxMindLicenseKey)
downloadUrl := common.EnvConfig.GeoLiteDBUrl
if strings.Contains(downloadUrl, "%s") {
downloadUrl = fmt.Sprintf(downloadUrl, common.EnvConfig.MaxMindLicenseKey)
}
ctx, cancel := context.WithTimeout(parentCtx, 10*time.Minute) ctx, cancel := context.WithTimeout(parentCtx, 10*time.Minute)
defer cancel() defer cancel()