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.
@@ -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,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sanka-baileyss",
3
- "version": "2.0.2",
3
+ "version": "2.0.3",
4
4
  "description": "WhatsApp API Modification By Sanka_Vollerei",
5
5
  "keywords": [
6
6
  "Baileys",