Fixes#4636
## Problem
WhatsApp voice messages (audio/ogg) were being saved as 0-byte files while
image downloads worked correctly. The issue is that Baileys 7.x
`downloadMediaMessage` with "buffer" mode returns empty data for audio
messages.
## Solution
- Changed from "buffer" mode to "stream" mode in `downloadInboundMedia()`
- Manually collect stream chunks and concatenate into buffer
- Added validation to detect and handle empty buffers
## Testing
- Voice messages now download correctly with actual audio data
- Image downloads continue to work as before
- Tested with WhatsApp voice notes (ogg/opus format)
Before fix: 0 bytes
After fix: 11488 bytes (actual audio data)
* feat(sessions): add channelIdleMinutes config for per-channel session idle durations
Add new `channelIdleMinutes` config option to allow different session idle
timeouts per channel. For example, Discord sessions can now be configured
to last 7 days (10080 minutes) while other channels use shorter defaults.
Config example:
sessions:
channelIdleMinutes:
discord: 10080 # 7 days
The channel-specific idle is passed as idleMinutesOverride to the existing
resolveSessionResetPolicy, integrating cleanly with the new reset policy
architecture.
* fix
* feat: add per-channel session reset overrides (#1353) (thanks @cash-echo-bot)
---------
Co-authored-by: Cash Williams <cashwilliams@gmail.com>
Co-authored-by: Peter Steinberger <steipete@gmail.com>
- Enhanced error handling in image reference detection to skip malformed file URLs without crashing.
- Updated media loading logic to throw an error for invalid file URLs, ensuring better feedback for users.
- Added support for detecting file URLs in prompts using fileURLToPath for accurate path resolution.
- Updated image loading logic to default to JPEG format for optimized image processing.
- Improved error handling in image optimization to continue processing on failures.
- Added handling for file URLs using fileURLToPath for proper resolution.
- Updated logic to skip relative path resolution if ref.resolved is already absolute.
- Enhanced cap calculation for image loading to handle undefined maxBytes more gracefully.