Fix path.join clearing scheme //

master
breel 2020-07-31 23:28:35 -06:00
parent 810fc0f44c
commit fe546bd77c
3 changed files with 5 additions and 2 deletions

@ -1 +1 @@
Subproject commit c5da36f592820312e10d05ff27c32d0ef644f282
Subproject commit f230c7fc9a25ff3e94d0be7152a86b23fd9ddb03

View File

@ -89,7 +89,7 @@ func whoGet(namespace string, g storage.RateLimitedGraph, w http.ResponseWriter,
baseUrl.RawQuery = ""
for k := range one.Attachments {
if _, err := url.Parse(one.Attachments[k]); err != nil || !strings.Contains(one.Attachments[k], ":") {
one.Attachments[k] = path.Join(baseUrl.String(), config.New().FilePrefix, namespace, one.Attachments[k])
one.Attachments[k] = baseUrl.String() + path.Join("/", config.New().FilePrefix, namespace, one.Attachments[k])
}
}

View File

@ -109,6 +109,9 @@ func TestWho(t *testing.T) {
if !strings.HasSuffix(o.Attachments[k], path.Join(config.New().FilePrefix, "col", iwant.Attachments[k])) {
t.Fatal(k, o.Attachments[k], iwant.Attachments[k])
}
if !strings.HasPrefix(o.Attachments[k], "http://") {
t.Fatal(k, o.Attachments[k], iwant.Attachments[k])
}
}
iwant.Attachments = o.Attachments
iwant.Connections = o.Connections