From b3b8d5117c88a8e5dea845426124357c19e95f8e Mon Sep 17 00:00:00 2001 From: perennial Date: Sun, 29 Sep 2024 20:09:03 +1000 Subject: [PATCH] revert to net/url in config.go --- config/config.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/config/config.go b/config/config.go index 18cf5ac..ba8c72b 100644 --- a/config/config.go +++ b/config/config.go @@ -10,7 +10,9 @@ import ( "strings" "time" - "github.com/goware/urlx" + // TODO: figure out how to properly implement urlx + // the implementation in 5f8b659b49 causes config.go to segfault due to a nil pointer dereference when the PIXIVFE_IMAGEPROXY env var is not set + // "github.com/goware/urlx" "github.com/sethvargo/go-envconfig" "codeberg.org/vnpower/pixivfe/v2/server/token_manager" @@ -93,7 +95,7 @@ func parseRevision(revision string) (date, hash string, isDirty bool) { // validateURL checks if the given URL is valid func validateURL(urlString string, urlType string) (*url.URL, error) { - parsedURL, err := urlx.Parse(urlString) + parsedURL, err := url.Parse(urlString) if err != nil { return nil, err } @@ -161,7 +163,7 @@ func (s *ServerConfig) LoadConfig() error { proxyURL, err := validateURL(s.ProxyServer_staging, "Proxy server") if err != nil { log.Printf("[WARNING] Invalid proxy server URL: %v. Falling back to built-in proxy URL.", err) - proxyURL, _ = urlx.Parse(BuiltinProxyUrl) // We know this is valid + proxyURL, _ = url.Parse(BuiltinProxyUrl) // We know this is valid log.Printf("Proxy server set to: %s\n", BuiltinProxyUrl) } else { log.Printf("Proxy server set to: %s\n", proxyURL.String())