mirror of
https://github.com/42wim/matterbridge.git
synced 2025-09-09 04:08:27 -04:00
Merge 1d3e6bfe93d0a3e76039c213ebd2e8d97076a310 into c4157a4d5b49fce79c80a30730dc7c404bacd663
This commit is contained in:
commit
196194b776
@ -569,7 +569,20 @@ func (b *Bmatrix) handleDownloadFile(rmsg *config.Message, content map[string]in
|
||||
if url, ok = content["url"].(string); !ok {
|
||||
return fmt.Errorf("url isn't a %T", url)
|
||||
}
|
||||
url = strings.Replace(url, "mxc://", b.GetString("Server")+"/_matrix/media/v1/download/", -1)
|
||||
|
||||
mediaURL := strings.Replace(url, "mxc://", b.GetString("Server")+"/_matrix/client/v1/media/download/", 1)
|
||||
logURL := mediaURL
|
||||
|
||||
token := b.GetString("Token")
|
||||
if token == "" && b.mc != nil && b.mc.AccessToken != "" {
|
||||
token = b.mc.AccessToken
|
||||
}
|
||||
if token != "" {
|
||||
logURL = mediaURL + "?access_token=[REDACTED]"
|
||||
mediaURL += "?access_token=" + token
|
||||
}
|
||||
url = mediaURL
|
||||
b.Log.Debugf("Generated Matrix media download URL: %s", logURL)
|
||||
|
||||
if info, ok = content["info"].(map[string]interface{}); !ok {
|
||||
return fmt.Errorf("info isn't a %T", info)
|
||||
|
Loading…
x
Reference in New Issue
Block a user