Skip to content

Commit f72aa45

Browse files
committed
fix(integrations): ensure file_data returns valid blob structure only if mime_type and file_uri are present (Cursor comment)
1 parent 4244319 commit f72aa45

1 file changed

Lines changed: 8 additions & 5 deletions

File tree

  • sentry_sdk/integrations/google_genai

sentry_sdk/integrations/google_genai/utils.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -297,11 +297,14 @@ def _extract_part_content(part: "Any") -> "Optional[dict[str, Any]]":
297297
if part.get("file_data"):
298298
file_data = part["file_data"]
299299
if isinstance(file_data, dict):
300-
return {
301-
"type": "blob",
302-
"mime_type": file_data.get("mime_type"),
303-
"file_uri": file_data.get("file_uri"),
304-
}
300+
mime_type = file_data.get("mime_type")
301+
file_uri = file_data.get("file_uri")
302+
if mime_type and file_uri:
303+
return {
304+
"type": "blob",
305+
"mime_type": mime_type,
306+
"file_uri": file_uri,
307+
}
305308

306309
if part.get("inline_data"):
307310
inline_data = part["inline_data"]

0 commit comments

Comments
 (0)