From 8b4d0bf1091f132ce68631cbf40e4a4d28c9a37a Mon Sep 17 00:00:00 2001 From: Renato Alcara Date: Wed, 25 Mar 2026 15:32:06 -0300 Subject: [PATCH] refactor: move waveform guard to flag definition for consistency Use typeof === 'undefined' check in the flag definition (line 242), matching the established pattern for seconds (line 239) and jpegThumbnail (line 241), instead of truthy check at usage point. This is more precise: typeof distinguishes undefined (not provided) from null (explicitly passed), and keeps all three media-processing flags using the same guard pattern. Co-Authored-By: Renato Alcara --- src/Utils/messages.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Utils/messages.ts b/src/Utils/messages.ts index a7d1f052..d601f016 100644 --- a/src/Utils/messages.ts +++ b/src/Utils/messages.ts @@ -239,7 +239,7 @@ export const prepareWAMessageMedia = async ( const requiresDurationComputation = mediaType === 'audio' && typeof uploadData.seconds === 'undefined' const requiresThumbnailComputation = (mediaType === 'image' || mediaType === 'video') && typeof uploadData['jpegThumbnail'] === 'undefined' - const requiresWaveformProcessing = mediaType === 'audio' && uploadData.ptt === true + const requiresWaveformProcessing = mediaType === 'audio' && uploadData.ptt === true && typeof uploadData.waveform === 'undefined' const requiresAudioBackground = options.backgroundColor && mediaType === 'audio' && uploadData.ptt === true const requiresOriginalForSomeProcessing = requiresDurationComputation || requiresThumbnailComputation const { mediaKey, encFilePath, originalFilePath, fileEncSha256, fileSha256, fileLength } = await encryptedStream(