Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Google Pub/Sub] Improve Messages Decode #19566

Merged
merged 4 commits into from Jun 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions Packs/GooglePubSub/Integrations/GooglePubSub/GooglePubSub.py
Expand Up @@ -746,7 +746,7 @@ def get_publish_body(message_attributes, message_data):
message = {}
if message_data:
# convert to base64 string
message["data"] = str(base64.b64encode(message_data.encode("utf8")))[2:-1]
message["data"] = base64.b64encode(message_data.encode("utf8")).decode('utf8')
if message_attributes:
message["attributes"] = attribute_pairs_to_dict(message_attributes)
body = {"messages": [message]}
Expand Down Expand Up @@ -832,7 +832,7 @@ def extract_acks_and_msgs(raw_msgs, add_ack_to_msg=True):
msg = raw_msg.get("message", {})
decoded_data = str(msg.get("data", ""))
try:
decoded_data = str(base64.b64decode(decoded_data))[2:-1]
decoded_data = base64.b64decode(decoded_data).decode("utf-8")
except Exception:
# display message with b64 value
pass
Expand Down
Expand Up @@ -843,7 +843,7 @@ script:
description: Acknowledge previously pulled message or messages.
execution: false
name: gcp-pubsub-topic-ack-messages
dockerimage: demisto/googleapi-python3:1.0.0.29817
dockerimage: demisto/googleapi-python3:1.0.0.30423
feed: false
isfetch: true
longRunning: false
Expand Down
Expand Up @@ -429,7 +429,7 @@ def ack_messages(self, a, b):
publish_message_command,
"publish_message",
{
"data": "42",
"data": "42\\42",
"project_id": "dmst-doc-prjct",
"topic_id": "dmst-test-topic",
},
Expand Down
Expand Up @@ -12,15 +12,15 @@
{
"topic": "dmst-test-topic",
"messageId": "123",
"data": "42",
"data": "42\\42",
"attributes": null
}
]
},
"gcp-pubsub-topic-messages-pull": {
"GoogleCloudPubSubPulledMessages(val && val.messageId === obj.messageId)": [
{
"data": "42",
"data": "42\\42",
"messageId": "123",
"publishTime": "2020-04-18T08:36:30.541Z"
}
Expand Down
Expand Up @@ -17,7 +17,7 @@
{
"ackId": "",
"message": {
"data": "42",
"data": "42\\42",
"messageId": "123",
"publishTime": "2020-04-18T08:36:30.541Z"
}
Expand Down
4 changes: 4 additions & 0 deletions Packs/GooglePubSub/ReleaseNotes/1_0_15.md
@@ -0,0 +1,4 @@

#### Integrations
##### Google Cloud Pub/Sub
- Fixed an issue where messages with backslashes were improperly decoded.
2 changes: 1 addition & 1 deletion Packs/GooglePubSub/pack_metadata.json
Expand Up @@ -2,7 +2,7 @@
"name": "Google Cloud Pub / Sub",
"description": "Google Cloud Pub / Sub is a fully-managed real-time messaging service that allows you to send and receive messages between independent applications.",
"support": "xsoar",
"currentVersion": "1.0.14",
"currentVersion": "1.0.15",
"author": "Cortex XSOAR",
"url": "https://www.paloaltonetworks.com/cortex",
"email": "",
Expand Down