Fix sticker patch
This commit is contained in:
parent
ec55e8f9ac
commit
5420eb6131
1 changed files with 10 additions and 8 deletions
|
@ -1,8 +1,8 @@
|
||||||
diff --git a/portal.go b/portal.go
|
diff --git a/portal.go b/portal.go
|
||||||
index d93ad17..198a12c 100644
|
index 3907859..25e0dc2 100644
|
||||||
--- a/portal.go
|
--- a/portal.go
|
||||||
+++ b/portal.go
|
+++ b/portal.go
|
||||||
@@ -874,7 +874,7 @@ func (portal *Portal) sendMatrixMessage(intent *appservice.IntentAPI, eventType
|
@@ -920,7 +920,7 @@ func (portal *Portal) sendMatrixMessage(intent *appservice.IntentAPI, eventType
|
||||||
|
|
||||||
func (portal *Portal) handleMatrixMessages(msg portalMatrixMessage) {
|
func (portal *Portal) handleMatrixMessages(msg portalMatrixMessage) {
|
||||||
switch msg.evt.Type {
|
switch msg.evt.Type {
|
||||||
|
@ -11,7 +11,7 @@ index d93ad17..198a12c 100644
|
||||||
portal.handleMatrixMessage(msg.user, msg.evt)
|
portal.handleMatrixMessage(msg.user, msg.evt)
|
||||||
case event.EventRedaction:
|
case event.EventRedaction:
|
||||||
portal.handleMatrixRedaction(msg.user, msg.evt)
|
portal.handleMatrixRedaction(msg.user, msg.evt)
|
||||||
@@ -1138,13 +1138,20 @@ func (portal *Portal) handleMatrixMessage(sender *User, evt *event.Event) {
|
@@ -1184,13 +1184,22 @@ func (portal *Portal) handleMatrixMessage(sender *User, evt *event.Event) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
sendReq.Content = portal.parseMatrixHTML(sender, content)
|
sendReq.Content = portal.parseMatrixHTML(sender, content)
|
||||||
|
@ -26,7 +26,9 @@ index d93ad17..198a12c 100644
|
||||||
+ // extract file suffix from mime type
|
+ // extract file suffix from mime type
|
||||||
+ mimeParts := strings.Split(content.Info.MimeType, "/")
|
+ mimeParts := strings.Split(content.Info.MimeType, "/")
|
||||||
+
|
+
|
||||||
+ if content.MsgType == "" && !strings.HasSuffix(content.Body, "." + mimeParts[1]) {
|
+ if content.MsgType == "" {
|
||||||
|
+ // the Body doesn’t contain the file name for stickers
|
||||||
|
+ content.Body = "sticker."
|
||||||
+ content.Body += mimeParts[1]
|
+ content.Body += mimeParts[1]
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
|
|
Reference in a new issue