summaryrefslogtreecommitdiffstats
path: root/matterclient/matterclient.go
diff options
context:
space:
mode:
authorWim <wim@42.be>2017-07-12 22:47:30 +0200
committerWim <wim@42.be>2017-07-12 22:47:30 +0200
commitac19c94b9f068fd92fdf6b06157c4af84cd1e197 (patch)
tree8861d2011a0c52d2ab39017e4edcef71292a8219 /matterclient/matterclient.go
parent845f7dc3311c2e9ca49f2b9f3192ab34d0bf1925 (diff)
downloadmatterbridge-msglm-ac19c94b9f068fd92fdf6b06157c4af84cd1e197.tar.gz
matterbridge-msglm-ac19c94b9f068fd92fdf6b06157c4af84cd1e197.tar.bz2
matterbridge-msglm-ac19c94b9f068fd92fdf6b06157c4af84cd1e197.zip
Add GetFileLinks, also get files if public links is disabled
Diffstat (limited to 'matterclient/matterclient.go')
-rw-r--r--matterclient/matterclient.go19
1 files changed, 19 insertions, 0 deletions
diff --git a/matterclient/matterclient.go b/matterclient/matterclient.go
index 8c2ebbb6..47fb2113 100644
--- a/matterclient/matterclient.go
+++ b/matterclient/matterclient.go
@@ -500,6 +500,25 @@ func (m *MMClient) GetPublicLinks(filenames []string) []string {
return output
}
+func (m *MMClient) GetFileLinks(filenames []string) []string {
+ uriScheme := "https://"
+ if m.NoTLS {
+ uriScheme = "http://"
+ }
+
+ var output []string
+ for _, f := range filenames {
+ res, err := m.Client.GetPublicLink(f)
+ if err != nil {
+ // public links is probably disabled, create the link ourselves
+ output = append(output, uriScheme+m.Credentials.Server+model.API_URL_SUFFIX_V3+"/files/"+f+"/get")
+ continue
+ }
+ output = append(output, res)
+ }
+ return output
+}
+
func (m *MMClient) UpdateChannelHeader(channelId string, header string) {
data := make(map[string]string)
data["channel_id"] = channelId