commit 898dcf801f23740f069687e5571c92b1ad7e6865
Author: Wim <wim@42.be>
Date: Tue Dec 19 23:44:13 2017 +0000
diff --git a/bridge/config/config.go b/bridge/config/config.go
index 10f1d5f..6953144 100644
--- a/bridge/config/config.go
+++ b/bridge/config/config.go
@@ -1826 +1829 @@ func NewConfig(cfgfile string) *Config {
if fail {
log.Fatalf("Fix your config. Please see changelog for more information")
}
+ if cfg.General.MediaDownloadSize == 0 {
+ cfg.General.MediaDownloadSize = 1000000
+ }
return &cfg
}
diff --git a/bridge/matrix/matrix.go b/bridge/matrix/matrix.go
index 03e493f..7e326c2 100644
--- a/bridge/matrix/matrix.go
+++ b/bridge/matrix/matrix.go
@@ -1757 +1757 @@ func (b *Bmatrix) handlematrix() error {
size := info["size"].(float64)
name := ev.Content["body"].(string)
flog.Debugf("trying to download %#v with size %#v", name, size)
- if size <= 1000000 {
+ if size <= float64(b.General.MediaDownloadSize) {
data, err := helper.DownloadFile(url)
if err != nil {
flog.Errorf("download %s failed %#v", url, err)
diff --git a/bridge/slack/slack.go b/bridge/slack/slack.go
index d6f73ff..51fe698 100644
--- a/bridge/slack/slack.go
+++ b/bridge/slack/slack.go
@@ -2887 +2887 @@ func (b *Bslack) handleSlack() {
// if we have a file attached, download it (in memory) and put a pointer to it in msg.Extra
if message.Raw.File != nil {
// limit to 1MB for now
- if message.Raw.File.Size <= 1000000 {
+ if message.Raw.File.Size <= b.General.MediaDownloadSize {
comment := ""
data, err := b.downloadFile(message.Raw.File.URLPrivateDownload)
if err != nil {
diff --git a/bridge/telegram/telegram.go b/bridge/telegram/telegram.go
index 95492a8..2aabf3a 100644
--- a/bridge/telegram/telegram.go
+++ b/bridge/telegram/telegram.go
@@ -2997 +2997 @@ func (b *Btelegram) handleDownload(file interface{}, msg *config.Message) {
// if we have a file attached, download it (in memory) and put a pointer to it in msg.Extra
// limit to 1MB for now
flog.Debugf("trying to download %#v fileid %#v with size %#v", name, fileid, size)
- if size <= 1000000 {
+ if size <= b.General.MediaDownloadSize {
data, err := helper.DownloadFile(url)
if err != nil {
flog.Errorf("download %s failed %#v", url, err)
diff --git a/matterbridge.toml.sample b/matterbridge.toml.sample
index d6fbe67..c261dec 100644
--- a/matterbridge.toml.sample
+++ b/matterbridge.toml.sample
@@ -10446 +104415 @@ MediaServerUpload="https://user:pass@yourserver.com/upload"
#OPTIONAL (default empty)
MediaServerDownload="https://youserver.com/download"
+#MediaDownloadSize is the maximum size of attachments, videos, images
+#matterbridge will download and upload this file to bridges that also support uploading files.
+#eg downloading from slack to upload it to mattermost
+#
+#It will only download from bridges that don't have public links available, which are for the moment
+#slack, telegram and matrix
+#
+#Optional (default 1000000 (1 megabyte))
+MediaDownloadSize=1000000
###################################################################
#Gateway configuration