mirror of
https://github.com/tulir/mautrix-whatsapp
synced 2024-05-19 20:33:45 +02:00
only add url field on sticker events (properly)
This commit is contained in:
parent
598e6e68fc
commit
0ebb235e61
13
portal.go
13
portal.go
|
@ -3434,12 +3434,6 @@ func (portal *Portal) uploadMedia(intent *appservice.IntentAPI, data []byte, con
|
|||
if file != nil {
|
||||
file.URL = mxc.CUString()
|
||||
content.File = file
|
||||
// Sticker events require the URL field to be present https://spec.matrix.org/v1.9/client-server-api/#events-16
|
||||
// This seems to affect only clients based on the Rust SDK on encrypted channels (like Element X)
|
||||
isSticker := string(content.MsgType) == event.EventSticker.Type
|
||||
if isSticker {
|
||||
content.URL = mxc.CUString()
|
||||
}
|
||||
} else {
|
||||
content.URL = mxc.CUString()
|
||||
}
|
||||
|
@ -3506,6 +3500,13 @@ func (portal *Portal) convertMediaMessage(intent *appservice.IntentAPI, source *
|
|||
return portal.makeMediaBridgeFailureMessage(info, fmt.Errorf("failed to upload media: %w", err), converted, nil, "")
|
||||
}
|
||||
}
|
||||
|
||||
// Sticker events require the URL field to be present https://spec.matrix.org/v1.9/client-server-api/#events-16
|
||||
// This seems to affect only clients based on the Rust SDK on encrypted channels (like Element X)
|
||||
if typeName == "sticker" && converted.Content.File != nil {
|
||||
converted.Content.URL = converted.Content.File.URL
|
||||
}
|
||||
|
||||
return converted
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue