From b03680a70ca15012ec581fc1e0b392bdb76dc480 Mon Sep 17 00:00:00 2001 From: noelcarcasesLYN Date: Fri, 30 Jan 2026 02:55:30 +0100 Subject: [PATCH] Fixes media upload to channels (#5697) Ensures correct media upload to channels by using the mimetype from mediaInfo, rather than the file, when creating OpaqueData. Also, it replaces the call to the function getRandomFilehash with the value of the function to retrieve the correct token. Co-authored-by: Noel Carcases Co-authored-by: Shir Serlui <70711723+shirser121@users.noreply.github.com> Co-authored-by: BenyFilho <168232825+BenyFilho@users.noreply.github.com> --- src/util/Injected/Utils.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/util/Injected/Utils.js b/src/util/Injected/Utils.js index 00f47bd..920dbe8 100644 --- a/src/util/Injected/Utils.js +++ b/src/util/Injected/Utils.js @@ -452,7 +452,7 @@ exports.LoadUtils = () => { window.WWebJS.processMediaData = async (mediaInfo, { forceSticker, forceGif, forceVoice, forceDocument, forceMediaHd, sendToChannel, sendToStatus }) => { const file = window.WWebJS.mediaInfoToFile(mediaInfo); - const opaqueData = await window.Store.OpaqueData.createFromData(file, file.type); + const opaqueData = await window.Store.OpaqueData.createFromData(file, mediaInfo.mimetype); const mediaParams = { asSticker: forceSticker, asGif: forceGif, @@ -506,7 +506,7 @@ exports.LoadUtils = () => { mimetype: mediaData.mimetype, mediaObject, mediaType, - ...(sendToChannel ? { calculateToken: window.Store.SendChannelMessage.getRandomFilehash() } : {}) + ...(sendToChannel ? { calculateToken: window.Store.SendChannelMessage.getRandomFilehash } : {}) }; const uploadedMedia = !sendToChannel