microsoft / microsoft/kiota

Escaping (or actually unescaping) special characters in query parameters

Open
#6,798 1 comment 0 reactions 0 assignees View on GitHub
dependency:service-API Python type:bug type:investigation
Dominant language
C#
Stars
3.8k
Forks
333
Avg merge
16h 29m
Merged PRs (30d)
116

Description

### What are you generating using Kiota, clients or plugins?

API Client/SDK

### In what context or format are you using Kiota?

Nuget tool

### Client library/SDK language

Python

### Describe the bug

I'm trying to obtain a Sharepoint download URL using the Microsoft Graph SDK. This requires requesting the field ` @microsoft.graph.downloadUrl` via the `select` parameter. This does not work since the character "@" is always url-encoded, with no apparent way to override this behavior (except opting out of the sdk).

### Expected behavior

There is a way to stop kiota from url-encoding "@".

### How to reproduce

```python
drive_item = (
await client.drives.by_drive_id(drive_id)
.items.by_drive_item_id(drive_item.id)
.get(
request_configuration=RequestConfiguration(
query_parameters=DriveItemItemRequestBuilder.DriveItemItemRequestBuilderGetQueryParameters(
select=[
"id",
"@microsoft.graph.downloadUrl",
"webUrl",
"name",
"size",
]
)
)
)
# Unfortunately we have to do this since kiota encodes the "@" which does not work
# .with_url(
# f"https://graph.microsoft.com/v1.0/drives/{drive_id}/items/{drive_item.id}?select=id,@microsoft.graph.downloadUrl"
# )
# .get()
)
```

### Open API description file

_No response_

### Kiota Version

1.9.5

### Latest Kiota version known to work for scenario above?(Not required)

_No response_

### Known Workarounds

_No response_

### Configuration

_No response_

### Debug output

Click to expand log
```

```

### Other information

_No response_

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the Python SDK request shown in the issue and trace how the select query parameter is encoded, focusing on the @ character. Done means callers can request @microsoft.graph.downloadUrl without opting out of the SDK, with coverage for this behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.