agentscope-ai / agentscope-ai/agentscope-java

[Bug]:GeminiMediaConverter rejects media URLs with query strings

Offen
#1,645 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
area/core/model bug
Vorherrschende Sprache
Java
Sterne
5.6k
Forks
1.3k
Ø Merge
4 T. 12 Std.
Gemergte PRs (30 T.)
77

Beschreibung

**Describe the bug**

`GeminiMediaConverter` rejects valid remote media URLs when the URL contains a query string or fragment.

For example, an image URL such as:

```text
http://localhost:64260/cat.png?token=abc123
```

is a valid PNG URL, but AgentScope-Java parses the extension as:

```text
png?token=abc123
```

and throws `Unsupported file extension`.

This affects common user scenarios such as CDN URLs, object storage signed URLs, temporary download URLs, and media URLs with cache/auth parameters.

**Expected behavior**

The converter should ignore the query string and fragment when inferring the file extension.

For:

```text
http://127.0.0.1:64260/cat.png?token=abc123
```

it should infer:

```text
png
```

and produce MIME type:

```text
image/png
```

The same should apply to URLs such as:

```text
https://cdn.example.com/audio.mp3?download=1
https://cdn.example.com/video.mp4#preview
```

**Error messages**

```text
FAILED: java.lang.IllegalArgumentException
MESSAGE: Unsupported file extension: png?token=abc123 for media type: image, expected one of: [png, jpeg, jpg, webp, heic, heif]
```

**Environment (please complete the following information):**

- AgentScope-Java Version:2.0
- Java Version: 17

**Additional context**

I would like to submit a PR to help fix this issue.

Beitragsleitfaden

Beitragsleitfaden öffnen

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.