1
1
mirror of https://github.com/go-gitea/gitea synced 2025-08-13 13:08:19 +00:00

Fix #4081 Check for leading / in base before removing it (#4083)

This commit is contained in:
Antoine GIRARD
2018-05-30 17:46:31 +02:00
committed by techknowlogick
parent 1177a19a5b
commit 561f459364
2 changed files with 8 additions and 2 deletions

View File

@@ -129,8 +129,8 @@ func URLJoin(base string, elems ...string) string {
return ""
}
joinedURL := baseURL.ResolveReference(argURL).String()
if !baseURL.IsAbs() {
return joinedURL[1:] // Removing leading '/'
if !baseURL.IsAbs() && !strings.HasPrefix(base, "/") {
return joinedURL[1:] // Removing leading '/' if needed
}
return joinedURL
}