kiota icon indicating copy to clipboard operation
kiota copied to clipboard

Escaping (or actually unescaping) special characters in query parameters

Open Pflyg opened this issue 5 months ago • 1 comments

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

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 ```
</details>


### Other information

_No response_

Pflyg avatar Aug 02 '25 21:08 Pflyg

Need to validate behavior with workload as field names prefixed with an @ are not supposed to be schematized and when using a select statement it should returned on all requests.

The work around is to not use the select statement while this behavior is investigated and corrective action is taken

gavinbarron avatar Nov 10 '25 20:11 gavinbarron