aboutsummaryrefslogtreecommitdiff
path: root/matrix
diff options
context:
space:
mode:
authorTulir Asokan <tulir@maunium.net>2018-04-15 14:03:05 +0300
committerTulir Asokan <tulir@maunium.net>2018-04-15 14:03:05 +0300
commitbb9ed4558b6ee64d81a8092e1bb0304c75b49c22 (patch)
treefd06b7f5038769653f492000e1719f2a1ae01797 /matrix
parent28e5f9d4b0384fe38299d60d5bf66d4441f387c3 (diff)
Refactor things
Diffstat (limited to 'matrix')
-rw-r--r--matrix/matrix.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/matrix/matrix.go b/matrix/matrix.go
index 48bb57f..25c52ba 100644
--- a/matrix/matrix.go
+++ b/matrix/matrix.go
@@ -419,6 +419,7 @@ func (c *Container) Download(mxcURL string) (data []byte, hs, id string, err err
err = fmt.Errorf("invalid matrix content URL")
return
}
+
hs = parts[1]
id = parts[2]
@@ -430,6 +431,11 @@ func (c *Container) Download(mxcURL string) (data []byte, hs, id string, err err
}
}
+ data, err = c.download(hs, id, cacheFile)
+ return
+}
+
+func (c *Container) download(hs, id, cacheFile string) (data []byte, err error) {
dlURL, _ := url.Parse(c.client.HomeserverURL.String())
dlURL.Path = path.Join(dlURL.Path, "/_matrix/media/v1/download", hs, id)