From 06299a3ed9e357a1dc5502a9e6b89fbaffa5d37b Mon Sep 17 00:00:00 2001 From: kim Date: Mon, 3 Mar 2025 15:46:15 +0000 Subject: [PATCH] also update to always iterate through all additional info fields --- internal/federation/dereferencing/media.go | 28 ++++++++++++---------- 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/internal/federation/dereferencing/media.go b/internal/federation/dereferencing/media.go index 3bed4b198..7fc9f9aef 100644 --- a/internal/federation/dereferencing/media.go +++ b/internal/federation/dereferencing/media.go @@ -125,19 +125,23 @@ func (d *Dereferencer) RefreshMedia( return attach, nil } - // Check emoji is up-to-date - // with provided extra info. - switch { - case info.Blurhash != nil && - *info.Blurhash != attach.Blurhash: + // Check blurhash up-to-date. + if info.Blurhash != nil && + *info.Blurhash != attach.Blurhash { attach.Blurhash = *info.Blurhash force = true - case info.Description != nil && - *info.Description != attach.Description: + } + + // Check description up-to-date. + if info.Description != nil && + *info.Description != attach.Description { attach.Description = *info.Description force = true - case info.RemoteURL != nil && - *info.RemoteURL != attach.RemoteURL: + } + + // Check remote URL up-to-date. + if info.RemoteURL != nil && + *info.RemoteURL != attach.RemoteURL { attach.RemoteURL = *info.RemoteURL force = true } @@ -213,10 +217,10 @@ func (d *Dereferencer) updateAttachment( ) } -// processingEmojiSafely provides concurrency-safe processing of -// an emoji with given shortcode+domain. if a copy of the emoji is +// processingMediaSafely provides concurrency-safe processing of +// a media with given remote URL string. if a copy of the media is // not already being processed, the given 'process' callback will -// be used to generate new *media.ProcessingEmoji{} instance. +// be used to generate new *media.ProcessingMedia{} instance. func (d *Dereferencer) processMediaSafeley( ctx context.Context, remoteURL string,