Repository navigation
Commit 270972d
fix(compat): percent-encode ids in v0.3 REST push config delete path (#1486)
# Description
The v0.3 REST client built the `DELETE
/v1/tasks/{task_id}/pushNotificationConfigs/{id}` path without
percent-encoding the ids. #1458 added `_quote_id` to the other six path
builders in `compat/v0_3/rest_transport.py`, but the delete call was
missed (its server route only landed later, in #1442). So deleting
`alerts#ops` sent `.../pushNotificationConfigs/alerts#ops`; the `#ops`
became a URL fragment and the server deleted `alerts` instead, leaving
`alerts#ops` in place. Ids with `?` or `%` are mangled the same way.
**Fix:** wrap both ids in `_quote_id`, as the get, list and create calls
already do.
## Testing
New case in the existing path-encoding tests in
`tests/compat/v0_3/test_rest_transport.py` (real handler + real client:
create `alerts` and `alerts#ops`, delete `alerts#ops`, check what's
left).
Before the fix:
```
AssertionError: assert ['alerts#ops'] == ['alerts']
1 failed, 2 passed
```
After:
```
3 passed
```
Full suite on main (a59bb68):
```
$ pytest tests --ignore=tests/integration/cross_version
2618 passed, 215 skipped, 4 xfailed, 1 xpassed
```
`ruff check` and `ruff format` pass.
- [x] Follow the [`CONTRIBUTING`
Guide](https://github.com/a2aproject/a2a-python/blob/main/CONTRIBUTING.md).
- [x] Make your Pull Request title in the
<https://www.conventionalcommits.org/> specification.
- [x] Ensure the tests and linter pass
- [x] Appropriate docs were updated (if necessary)
Fixes #1485 🦕
Co-authored-by: Mateusz Iwaniuk <45974414+Iwaniukooo11@users.noreply.github.com>1 parent a6dd087 commit 270972d
2 files changed
Lines changed: 26 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
302 | 302 | | |
303 | 303 | | |
304 | 304 | | |
305 | | - | |
| 305 | + | |
| 306 | + | |
306 | 307 | | |
307 | 308 | | |
308 | 309 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
990 | 990 | | |
991 | 991 | | |
992 | 992 | | |
| 993 | + | |
| 994 | + | |
| 995 | + | |
| 996 | + | |
| 997 | + | |
| 998 | + | |
| 999 | + | |
| 1000 | + | |
| 1001 | + | |
| 1002 | + | |
| 1003 | + | |
| 1004 | + | |
| 1005 | + | |
| 1006 | + | |
| 1007 | + | |
| 1008 | + | |
| 1009 | + | |
| 1010 | + | |
| 1011 | + | |
| 1012 | + | |
| 1013 | + | |
| 1014 | + | |
| 1015 | + | |
| 1016 | + | |
0 commit comments