sanka-baileyss 2.0.2 → 2.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/Utils/messages.js +9 -1
- package/package.json +1 -1
package/lib/Utils/messages.js
CHANGED
|
@@ -172,7 +172,15 @@ const prepareWAMessageMedia = async (message, options) => {
|
|
|
172
172
|
const requiresWaveformProcessing = mediaType === 'audio' && uploadData.ptt === true
|
|
173
173
|
const requiresAudioBackground = options.backgroundColor && mediaType === 'audio' && uploadData.ptt === true
|
|
174
174
|
const requiresOriginalForSomeProcessing = requiresDurationComputation || requiresThumbnailComputation
|
|
175
|
-
|
|
175
|
+
|
|
176
|
+
// Validasi tambahan sebelum di proses medianya
|
|
177
|
+
if (typeof uploadData.media !== 'object' || uploadData.media === null) {
|
|
178
|
+
throw new boom_1.Boom(`Invalid media format: expected buffer or stream, got ${typeof uploadData.media}`, { statusCode: 400 })
|
|
179
|
+
}
|
|
180
|
+
if (typeof uploadData.media === 'function') {
|
|
181
|
+
throw new boom_1.Boom(`Media type error: received a function instead of buffer/stream. Check your sendMessage input.`, { statusCode: 400 })
|
|
182
|
+
}
|
|
183
|
+
|
|
176
184
|
const { mediaKey, encFilePath, originalFilePath, fileEncSha256, fileSha256, fileLength } = await (options.newsletter ? messages_media_1.prepareStream : messages_media_1.encryptedStream)(uploadData.media, options.mediaTypeOverride || mediaType, {
|
|
177
185
|
logger,
|
|
178
186
|
saveOriginalFileIfRequired: requiresOriginalForSomeProcessing,
|