summaryrefslogtreecommitdiff
path: root/internal/util/util.go
diff options
context:
space:
mode:
authorjwijenbergh <jeroenwijenbergh@protonmail.com>2022-10-17 11:32:19 +0200
committerjwijenbergh <jeroenwijenbergh@protonmail.com>2022-10-17 11:44:18 +0200
commit8635f8bbf5e4383fb2db6774757157f29195aec1 (patch)
treedb1bf71bf903a920b1330cc88689778adf19725d /internal/util/util.go
parent51b536b45fce6bf2d7ec8bbfe6ce30faec11c88e (diff)
Server + Util: Ensure the base URL already ends with a /
Diffstat (limited to 'internal/util/util.go')
-rw-r--r--internal/util/util.go9
1 files changed, 8 insertions, 1 deletions
diff --git a/internal/util/util.go b/internal/util/util.go
index a8abd80..a500e15 100644
--- a/internal/util/util.go
+++ b/internal/util/util.go
@@ -29,7 +29,14 @@ func EnsureValidURL(s string) (string, error) {
// https://pkg.go.dev/path#Clean
parsedURL.Path = path.Clean(parsedURL.Path)
}
- return parsedURL.String(), nil
+
+ returnedURL := parsedURL.String()
+
+ // Make sure the URL ends with a /
+ if returnedURL[len(returnedURL)-1:] != "/" {
+ returnedURL = returnedURL + "/"
+ }
+ return returnedURL, nil
}
// Creates a random byteslice of `size`