Fix Matrix voice message check

This commit is contained in:
Tulir Asokan 2024-03-11 17:09:02 +02:00
parent d9364a7b7f
commit 7c9483bc2b
2 changed files with 3 additions and 2 deletions

View file

@ -7,6 +7,7 @@
be online. Google Fi cloud sync is still not supported. be online. Google Fi cloud sync is still not supported.
* Added deduplication for DM participants, as Google randomly sends duplicate * Added deduplication for DM participants, as Google randomly sends duplicate
participant entries sometimes. participant entries sometimes.
* Added voice message conversion.
* Changed custom image reactions to be bridged as `:custom:` instead of a UUID. * Changed custom image reactions to be bridged as `:custom:` instead of a UUID.
Google Messages for Web doesn't support fetching the actual image yet. Google Messages for Web doesn't support fetching the actual image yet.
* Fixed sending reactions breaking for some users. * Fixed sending reactions breaking for some users.

View file

@ -1985,8 +1985,8 @@ func (portal *Portal) reuploadMedia(ctx context.Context, sender *User, content *
if content.FileName != "" { if content.FileName != "" {
fileName = content.FileName fileName = content.FileName
} }
isVoice, ok := raw["org.matrix.msc3245.voice"].(bool) _, isVoice := raw["org.matrix.msc3245.voice"]
if ok && isVoice { if isVoice {
data, err = ffmpeg.ConvertBytes(ctx, data, ".m4a", []string{}, []string{"-c:a", "aac"}, content.Info.MimeType) data, err = ffmpeg.ConvertBytes(ctx, data, ".m4a", []string{}, []string{"-c:a", "aac"}, content.Info.MimeType)
if err != nil { if err != nil {
return nil, fmt.Errorf("%w (ogg to m4a): %w", errMediaConvertFailed, err) return nil, fmt.Errorf("%w (ogg to m4a): %w", errMediaConvertFailed, err)