-
Notifications
You must be signed in to change notification settings - Fork 352
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
Inconsistent encoding of odata.id on server and client #2857
Comments
This inconsistency is likely a bug. Curious, does the server not encode the url at all, or it encodes a different set of characters than the client? (asking because I don't think we consider a comma as a special character that has to be escaped). |
Hi Clément
Here
If I override
|
Moved this issue to AspNetCoreOData repos: OData/AspNetCoreOData#1390 |
Only slash / gets encoded from a string key in odata links and in Location header. This is done in AspNet Core OData. As said I moved this report to that repos. |
Calculation of self links is encoded on client but unencoded on server.
Assemblies affected
OData .Net lib 7.2 hosted under AspNetCore OData 8.2
Reproduce steps
I have an OData V4 service implemented with AspNetCore OData and ODataLib.
I have a model with an entity called CustomLabel.
CustomLabel has a single string type key property called ID.
I have a CustomLabel instance with ID = "AA,TY".
Serializing this entity with odata.matadata=full gives unencoded odata.id and odata.editLink like .../CustomLabels('AA,TY').
If odata.metadata=minimal the odata.id and odata.editLink are constructed in OData Client from the metadata specification, but here they endup encoded like .../CustomLabels('AA%2CTY').
This gives problems with DataServiceContext.Entites when the same entity are returned from multiple requests with diferent odata.metadata settings and the same entity is not correctly matched against the already tracked entity and it will endup with multiple entries in the tracked entity collection.
Should the id and editlink be encoded or not?
What is correct and what is incorrect?
Is it a bug in OData.Client, OData.Core or in AspNetCore.OData?
Expected result
The id, editLink (selfLinks) are the same regardles if they are picked op from the payload or generated on the client from metadata.
Actual result
The OData Client sees the same entity as 2 different entities as their ids are not exactly the same. Check the last 2 EntityDescriptor entries in this context.Entities watch...
Additional detail
On OData V3 (using WCF Data Services) the id and editLinks returned from server were encoded like .../CustomLabels('AA%2CTY')..
The text was updated successfully, but these errors were encountered: