attachments: remove trace logging

This was for debugging in development only. Also, bridges default to the
DEBUG level, so this would not be logged at all unless you intentionally
modified your logging configuration.
This commit is contained in:
Skip R
2025-11-26 18:28:50 -08:00
parent b5e6db06f8
commit 7b32aad13f

View File

@@ -69,7 +69,6 @@ func downloadDiscordAttachment(cli *http.Client, url string, maxSize int64) ([]b
}
func (d *DiscordConnector) ReuploadMedia(ctx context.Context, intent bridgev2.MatrixAPI, portal *bridgev2.Portal, upload attachment.AttachmentReupload) (*attachment.ReuploadedAttachment, error) {
log := zerolog.Ctx(ctx)
// TODO(skip): Do we need to check if we've already downloaded this media before?
// TODO(skip): Read a maximum size from the config.
data, err := downloadDiscordAttachment(http.DefaultClient, upload.DownloadingURL, 1_024*1_024*50)
@@ -84,20 +83,13 @@ func (d *DiscordConnector) ReuploadMedia(ctx context.Context, intent bridgev2.Ma
}
fileName := path.Base(url.Path)
upload.FileName = fileName
log.Trace().Str("detected_file_name", fileName).Msg("Inferred the file name of the media we're reuploading")
}
if upload.MimeType == "" {
mime := http.DetectContentType(data)
upload.MimeType = mime
log.Trace().Str("detected_mime_type", mime).Msg("Inferred the mime type of the media we're reuploading")
}
log.Trace().Stringer("portal_mxid", portal.MXID).
Int("attachment_size", len(data)).
Str("file_name", upload.FileName).
Str("mime_type", upload.MimeType).
Msg("Uploading downloaded media")
mxc, file, err := intent.UploadMedia(ctx, portal.MXID, data, upload.FileName, upload.MimeType)
if err != nil {
return nil, err