fix(signal): use id instead of attachmentId in getAttachment RPC
Cherry-picked from PR #2365 by @xerpert. Three bugs preventing Signal image attachments from being processed: 1. signal-cli getAttachment RPC expects 'id', not 'attachmentId' 2. signal-cli daemon returns dict {"data": "base64..."} not raw base64 3. MessageType.IMAGE doesn't exist — correct enum is MessageType.PHOTO
This commit is contained in:
@@ -478,7 +478,7 @@ class SignalAdapter(BasePlatformAdapter):
|
||||
if any(mt.startswith("audio/") for mt in media_types):
|
||||
msg_type = MessageType.VOICE
|
||||
elif any(mt.startswith("image/") for mt in media_types):
|
||||
msg_type = MessageType.IMAGE
|
||||
msg_type = MessageType.PHOTO
|
||||
|
||||
# Parse timestamp from envelope data (milliseconds since epoch)
|
||||
ts_ms = envelope_data.get("timestamp", 0)
|
||||
@@ -519,6 +519,13 @@ class SignalAdapter(BasePlatformAdapter):
|
||||
if not result:
|
||||
return None, ""
|
||||
|
||||
# Handle dict response (signal-cli returns {"data": "base64..."})
|
||||
if isinstance(result, dict):
|
||||
result = result.get("data")
|
||||
if not result:
|
||||
logger.warning("Signal: attachment response missing 'data' key")
|
||||
return None, ""
|
||||
|
||||
# Result is base64-encoded file content
|
||||
raw_data = base64.b64decode(result)
|
||||
ext = _guess_extension(raw_data)
|
||||
|
||||
Reference in New Issue
Block a user