Use https by default if scheme is not provided

This commit is contained in:
Tulir Asokan
2019-06-16 17:14:51 +03:00
parent 967db30762
commit 6eaee84465
3 changed files with 6 additions and 1 deletions

View File

@ -713,6 +713,9 @@ func (c *Container) Download(mxcURL string) (data []byte, hs, id string, err err
func (c *Container) GetDownloadURL(hs, id string) string {
dlURL, _ := url.Parse(c.client.HomeserverURL.String())
if dlURL.Scheme == "" {
dlURL.Scheme = "https"
}
dlURL.Path = path.Join(dlURL.Path, "/_matrix/media/v1/download", hs, id)
return dlURL.String()
}