store: fix GetByMXC parameter type
This commit is contained in:
@@ -560,7 +560,7 @@ func (t *TelegramClient) PreHandleMatrixReaction(ctx context.Context, msg *bridg
|
||||
keyNoVariation := variationselector.Remove(msg.Content.RelatesTo.Key)
|
||||
emojiID := ids.MakeEmojiIDFromEmoticon(msg.Content.RelatesTo.Key)
|
||||
if strings.HasPrefix(msg.Content.RelatesTo.Key, "mxc://") {
|
||||
if file, err := t.main.Store.TelegramFile.GetByMXC(ctx, msg.Content.RelatesTo.Key); err != nil {
|
||||
if file, err := t.main.Store.TelegramFile.GetByMXC(ctx, id.ContentURIString(msg.Content.RelatesTo.Key)); err != nil {
|
||||
return resp, err
|
||||
} else if file == nil {
|
||||
return resp, fmt.Errorf("reaction MXC URI %s does not correspond with any known Telegram files", msg.Content.RelatesTo.Key)
|
||||
|
||||
@@ -405,7 +405,7 @@ func (parser *HTMLParser) imgToString(node *html.Node, ctx Context) *EntityStrin
|
||||
if !isEmoji {
|
||||
return NewEntityString(alt)
|
||||
}
|
||||
if file, _ := parser.Store.TelegramFile.GetByMXC(ctx.Ctx, src); file != nil {
|
||||
if file, _ := parser.Store.TelegramFile.GetByMXC(ctx.Ctx, id.ContentURIString(src)); file != nil {
|
||||
if documentID, err := strconv.ParseInt(string(file.LocationID), 10, 64); err == nil {
|
||||
// Hardcode to a sparkle emoji because telegram requires the custom emoji fallback to be an emoji,
|
||||
// but we don't know the actual emoji that should be used.
|
||||
|
||||
@@ -60,7 +60,7 @@ func (fq *TelegramFileQuery) GetByLocationID(ctx context.Context, locationID Tel
|
||||
return fq.QueryOne(ctx, getTelegramFileByLocationIDQuery, locationID)
|
||||
}
|
||||
|
||||
func (fq *TelegramFileQuery) GetByMXC(ctx context.Context, mxc string) (*TelegramFile, error) {
|
||||
func (fq *TelegramFileQuery) GetByMXC(ctx context.Context, mxc id.ContentURIString) (*TelegramFile, error) {
|
||||
return fq.QueryOne(ctx, getTelegramFileByMXCQuery, mxc)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user