mirror of
https://codeberg.org/Codeberg/pages-server.git
synced 2025-04-24 22:06:57 +00:00
well we have to copy...
This commit is contained in:
parent
c00fb87ae9
commit
a9f63de328
2 changed files with 4 additions and 2 deletions
|
@ -30,8 +30,9 @@ type FileResponse struct {
|
|||
}
|
||||
|
||||
func joinURL(baseURL *url.URL, paths ...string) string {
|
||||
baseURL.Path = path.Join(append([]string{baseURL.Path}, paths...)...)
|
||||
return baseURL.String()
|
||||
b := *baseURL
|
||||
b.Path = path.Join(append([]string{b.Path}, paths...)...)
|
||||
return b.String()
|
||||
}
|
||||
|
||||
func (f FileResponse) IsEmpty() bool { return len(f.Body) != 0 }
|
||||
|
|
|
@ -17,4 +17,5 @@ func TestJoinURL(t *testing.T) {
|
|||
|
||||
baseURL, _ = url.Parse("http://wow.url.com/subpath/2/")
|
||||
assert.EqualValues(t, "http://wow.url.com/subpath/2/content.pdf", joinURL(baseURL, "/content.pdf"))
|
||||
assert.EqualValues(t, "http://wow.url.com/subpath/2/wonderful.jpg", joinURL(baseURL, "wonderful.jpg"))
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue