aboutsummaryrefslogtreecommitdiff
path: root/mxlib/client.go
diff options
context:
space:
mode:
Diffstat (limited to 'mxlib/client.go')
-rw-r--r--mxlib/client.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/mxlib/client.go b/mxlib/client.go
index 6d87663..d8237d1 100644
--- a/mxlib/client.go
+++ b/mxlib/client.go
@@ -280,6 +280,11 @@ func (mx *Client) RoomTopicAs(room string, topic string, as_user string) error {
}
func (mx *Client) UploadMedia(m connector.MediaObject) (*MediaObject, error) {
+ // Return early if this is already a Matrix media object
+ if mxm, ok := m.(*MediaObject); ok {
+ return mxm, nil
+ }
+
reader, err := m.Read()
if err != nil {
return nil, err
@@ -308,6 +313,7 @@ func (mx *Client) UploadMedia(m connector.MediaObject) (*MediaObject, error) {
filename: m.Filename(),
size: m.Size(),
mimetype: m.Mimetype(),
+ imageSize: m.ImageSize(),
MxcServer: mxc[0],
MxcMediaId: mxc[1],
}