diff --git a/internal/config/config.go b/internal/config/config.go index d012649d60..f0e69ad798 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -226,7 +226,7 @@ func (c *Config) ToFakeGcsOptions(logger *slog.Logger, scheme string) fakestorag Host: c.Host, Port: uint16(port), PublicHost: c.publicHost, - ExternalURL: c.externalURL, + ExternalURL: strings.TrimRight(c.externalURL, "/"), AllowedCORSHeaders: c.allowedCORSHeaders, Writer: &slogWriter{logger: logger, level: slog.LevelInfo}, EventOptions: eventOptions, diff --git a/internal/config/config_test.go b/internal/config/config_test.go index 2ba8dbabac..ce3e4c6528 100644 --- a/internal/config/config_test.go +++ b/internal/config/config_test.go @@ -416,6 +416,27 @@ func TestToFakeGcsOptions(t *testing.T) { NoListener: true, }, }, + { + "external-url with trailing slashes", + Config{ + backend: "memory", + fsRoot: "/tmp/something", + publicHost: "127.0.0.1.nip.io:8443", + externalURL: "https://myhost.example.com:8443/", + Host: "0.0.0.0", + Port: 443, + Scheme: "https", + }, + fakestorage.Options{ + StorageRoot: "", + PublicHost: "127.0.0.1.nip.io:8443", + ExternalURL: "https://myhost.example.com:8443", + Host: "0.0.0.0", + Port: 443, + Scheme: "https", + NoListener: true, + }, + }, } for _, test := range tests {