aboutsummaryrefslogtreecommitdiffstats
path: root/services/lfs
diff options
context:
space:
mode:
Diffstat (limited to 'services/lfs')
-rw-r--r--services/lfs/server.go7
1 files changed, 4 insertions, 3 deletions
diff --git a/services/lfs/server.go b/services/lfs/server.go
index 5ce2a5498a..7887658816 100644
--- a/services/lfs/server.go
+++ b/services/lfs/server.go
@@ -12,6 +12,7 @@ import (
"fmt"
"io"
"net/http"
+ "net/url"
"path"
"regexp"
"strconv"
@@ -46,17 +47,17 @@ type Claims struct {
// DownloadLink builds a URL to download the object.
func (rc *requestContext) DownloadLink(p lfs_module.Pointer) string {
- return setting.AppURL + path.Join(rc.User, rc.Repo+".git", "info/lfs/objects", p.Oid)
+ return setting.AppURL + path.Join(url.PathEscape(rc.User), url.PathEscape(rc.Repo+".git"), "info/lfs/objects", url.PathEscape(p.Oid))
}
// UploadLink builds a URL to upload the object.
func (rc *requestContext) UploadLink(p lfs_module.Pointer) string {
- return setting.AppURL + path.Join(rc.User, rc.Repo+".git", "info/lfs/objects", p.Oid, strconv.FormatInt(p.Size, 10))
+ return setting.AppURL + path.Join(url.PathEscape(rc.User), url.PathEscape(rc.Repo+".git"), "info/lfs/objects", url.PathEscape(p.Oid), strconv.FormatInt(p.Size, 10))
}
// VerifyLink builds a URL for verifying the object.
func (rc *requestContext) VerifyLink(p lfs_module.Pointer) string {
- return setting.AppURL + path.Join(rc.User, rc.Repo+".git", "info/lfs/verify")
+ return setting.AppURL + path.Join(url.PathEscape(rc.User), url.PathEscape(rc.Repo+".git"), "info/lfs/verify")
}
// CheckAcceptMediaType checks if the client accepts the LFS media type.