Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions bridge/matrix/matrix.go
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,6 @@ func (b *Bmatrix) Send(msg config.Message) (string, error) {
// Upload a file if it exists
if msg.Extra != nil {
for _, rmsg := range helper.HandleExtra(&msg, b.General) {
rmsg := rmsg

err := b.retry(func() error {
_, err := b.mc.SendText(channel, rmsg.Username+rmsg.Text)
Expand Down Expand Up @@ -570,7 +569,8 @@ 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.ReplaceAll(url, "mxc://", b.GetString("Server")+"/_matrix/media/v1/download/")
// https://github.com/matrix-org/matrix-spec-proposals/blob/main/proposals/3916-authentication-for-media.md
url = strings.ReplaceAll(url, "mxc://", b.GetString("Server")+"/_matrix/client/v1/media/download/")

if info, ok = content["info"].(map[string]interface{}); !ok {
return fmt.Errorf("info isn't a %T", info)
Expand Down Expand Up @@ -607,7 +607,7 @@ func (b *Bmatrix) handleDownloadFile(rmsg *config.Message, content map[string]in
return err
}
// actually download the file
data, err := helper.DownloadFile(url)
data, err := helper.DownloadFileAuth(url, "Bearer "+b.mc.AccessToken)
if err != nil {
return fmt.Errorf("download %s failed %#v", url, err)
}
Expand Down
Loading