fix(signal): use media_urls/media_types in MessageEvent construction#871
Merged
fix(signal): use media_urls/media_types in MessageEvent construction#871
Conversation
…_paths/audio_path/document_paths The Signal adapter was passing image_paths, audio_path, and document_paths to MessageEvent.__init__(), but those fields don't exist on the dataclass. MessageEvent uses media_urls (List[str]) and media_types (List[str]). Changes: - Replace separate image_paths/audio_path/document_paths with unified media_urls and media_types lists (matching Discord, Slack, etc.) - Add _ext_to_mime() helper to map file extensions to MIME types - Use Signal's contentType from attachment metadata when available, falling back to extension-based mapping - Update message type detection to check media_types prefixes Fixes TypeError: MessageEvent.__init__() got an unexpected keyword argument 'image_paths'
Contributor
Author
|
Merged to main via 53be6af. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The Signal adapter was passing
image_paths,audio_path, anddocument_pathskwargs toMessageEvent.__init__(), but those fields don't exist on the dataclass. This causes:Reported by alphakamp.
Root Cause
MessageEvent(ingateway/platforms/base.py) usesmedia_urls: List[str]andmedia_types: List[str]for media attachments. The Signal adapter was using its own non-standard field names that don't match the interface used by Discord, Slack, Telegram, and WhatsApp adapters.Fix
image_paths,audio_path,document_pathsvariables with unifiedmedia_urlsandmedia_typeslists (consistent with all other adapters)_ext_to_mime()helper to map file extensions to MIME typescontentTypefrom attachment metadata when available, falling back to extension-based mappingmedia_typesprefixes (audio/,image/)Testing
All 493 gateway tests pass. All 35 signal-specific tests pass.