mirror of
https://github.com/42wim/matterbridge.git
synced 2024-11-30 22:52:00 -08:00
send URL for files if config is set to send URLs
This commit is contained in:
parent
2f12fa3c61
commit
fd38b8d54a
@ -540,9 +540,18 @@ func (b *Bmatrix) handleEvent(ev *matrix.Event) {
|
|||||||
|
|
||||||
// Do we have attachments
|
// Do we have attachments
|
||||||
if b.containsAttachment(ev.Content) {
|
if b.containsAttachment(ev.Content) {
|
||||||
err := b.handleDownloadFile(&rmsg, ev.Content)
|
if b.GetBool("SendUrlNotFile") {
|
||||||
if err != nil {
|
// replace the text of the message (which is set to the filename above) with the url
|
||||||
b.Log.Errorf("download failed: %#v", err)
|
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)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user