mirror of
https://github.com/42wim/matterbridge.git
synced 2024-11-28 05:32:01 -08:00
send URL for files if config is set to send URLs
This commit is contained in:
parent
2f12fa3c61
commit
fd38b8d54a
@ -540,11 +540,20 @@ func (b *Bmatrix) handleEvent(ev *matrix.Event) {
|
||||
|
||||
// Do we have attachments
|
||||
if b.containsAttachment(ev.Content) {
|
||||
if b.GetBool("SendUrlNotFile") {
|
||||
// replace the text of the message (which is set to the filename above) with the url
|
||||
var err error
|
||||
rmsg.Text, err = b.getMessageFileUrl(ev.Content)
|
||||
if err != nil {
|
||||
b.Log.Errorf("get url for uploaded file failed: %#v", err)
|
||||
}
|
||||
} else {
|
||||
err := b.handleDownloadFile(&rmsg, ev.Content)
|
||||
if err != nil {
|
||||
b.Log.Errorf("download failed: %#v", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
b.Log.Debugf("<= Sending message from %s on %s to gateway", ev.Sender, b.Account)
|
||||
b.Remote <- rmsg
|
||||
|
Loading…
Reference in New Issue
Block a user