Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/google/adk/tools/load_artifacts_tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def _normalize_mime_type(mime_type: str | None) -> str | None:
"""Returns the normalized MIME type, without parameters like charset."""
if not mime_type:
return None
return mime_type.split(';', 1)[0].strip()
return mime_type.split(';', 1)[0].strip().lower()


def _is_inline_mime_type_supported(mime_type: str | None) -> bool:
Expand Down
9 changes: 8 additions & 1 deletion tests/unittests/tools/test_load_artifacts_tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,14 @@ async def test_load_artifacts_keeps_supported_mime_types():
@pytest.mark.asyncio
@pytest.mark.parametrize(
'mime_type',
['image/svg+xml', 'image/svg', 'application/svg+xml', 'image/xml'],
[
'image/svg+xml',
'image/svg',
'application/svg+xml',
'image/xml',
'Image/SVG+XML; charset=UTF-8',
'APPLICATION/SVG+XML',
],
)
async def test_load_artifacts_converts_svg_to_text(mime_type):
"""SVG/XML image variants are rejected by Gemini with 400 INVALID_ARGUMENT,
Expand Down
Loading