Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Double unescaping of function parameters? #1131

Closed
sherlock1982 opened this issue Dec 6, 2023 · 2 comments
Closed

Double unescaping of function parameters? #1131

sherlock1982 opened this issue Dec 6, 2023 · 2 comments
Labels
bug Something isn't working

Comments

@sherlock1982
Copy link

sherlock1982 commented Dec 6, 2023

Assemblies affected
ASP.NET Core OData 8.2.3

Describe the bug
Function parameters needs to be escaped twice

Reproduce steps
I have an entity Foo with a string key. And I can call delete method like this:

DELETE /Foo('key%253A')

The string key%3A was escaped. This works fine and key will have a proper value key%3A

Now I have a function that takes two parameters. And I call it like this:

 GET /Foo/Func(val1=5,val2='key%253A')

I expect val2 to have the value key%3A while in reality the value will be key:. Meaning that somewhere inside OData this value was unescaped twice.

Expected behavior
One time escape should be enough

Additional context
The only place I found where OData directly does UnescapeDataString is inside SegmentTemplateHelpers.cs. I want to understand if this double escaping is desirable and if it is what are the rules?
Why I have to double escape function parameters but not entity operation parameters?

Way to reproduce

Check this repository:
https://github.com/sherlock1982/odata-double-escape

Note that you can get entity /Foo with 'key%3A' correctly. - OK
But if you call the function /MyFunction with 'key%3A' the result will be 'key:' - NOK

@sherlock1982 sherlock1982 added the bug Something isn't working label Dec 6, 2023
@sherlock1982 sherlock1982 changed the title Double escaping of function parameters? Double unescaping of function parameters? Dec 7, 2023
@xuzhg
Copy link
Member

xuzhg commented Dec 7, 2023

@xuzhg
Copy link
Member

xuzhg commented Dec 7, 2023

See: #806

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants