Skip to content

Commit d94be76

Browse files
committed
Revert "fix the way matrix audio mimetype handling works"
This reverts commit 687e5e0.
1 parent 714848c commit d94be76

1 file changed

Lines changed: 1 addition & 4 deletions

File tree

bridge/matrix/matrix.go

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import (
1111
"net/http"
1212
"path"
1313
"regexp"
14-
"slices"
1514
"strings"
1615
"sync"
1716
"time"
@@ -32,8 +31,6 @@ import (
3231
"maunium.net/go/mautrix/id"
3332
)
3433

35-
var Audio_MimeTypes = []string{"aac", "flac", "matroska", "mp4", "mpeg", "ogg", "opus", "vorbis", "wav"}
36-
3734
var (
3835
htmlTag = regexp.MustCompile("</.*?>")
3936
htmlReplacementTag = regexp.MustCompile("<[^>]*>")
@@ -935,7 +932,7 @@ func (b *Bmatrix) handleUploadFile(msg *config.Message, roomID id.RoomID, fi *co
935932
if err != nil {
936933
b.Log.Errorf("sendImage failed: %#v", err)
937934
}
938-
case strings.HasPrefix(mtype, "audio/") && func() bool { s, _ := strings.CutPrefix(mtype, "audio/"); return slices.Contains(Audio_MimeTypes, s) }():
935+
case strings.Contains(mtype, "audio") && regexp.MustCompile(`(aac|flac|matroska|mp4|mpeg|ogg|opus|vorbis|wav)$`).MatchString(mtype): // god this is such a hack
939936
b.Log.Debugf("sendAudio %s", res.ContentURI)
940937
err = b.retry(func() error {
941938
content := event.MessageEventContent{

0 commit comments

Comments
 (0)