-
Notifications
You must be signed in to change notification settings - Fork 351
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
Fix relative context Uri resolution #1211
base: release-7.x
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||
---|---|---|---|---|
|
@@ -176,6 +176,11 @@ public ODataMessageQuotas MessageQuotas | |||
/// </summary> | ||||
public bool ReadUntypedAsString { get; set; } | ||||
|
||||
/// <summary> | ||||
/// Gets or sets current request Uri. | ||||
/// </summary> | ||||
public Uri RequestUri { get; set; } | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What's the relationship between the new RequestUri property and the existing BaseUri property? When does RequestUri get set? Can we just use BaseUri? #ByDesign There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. BaseUri is for Atom format and may be deprecated in the future. See
In reply to: 203896122 [](ancestors = 203896122) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The reason it was to be deprecated was because it was only used in Atom. The reason it was only used in Atom was because we previously didn't support relative URLs in JSON. Now that we support relative URLs in JSON, it seems like we should use this (existing) property, rather than deprecate it and add a new one for the same purpose. In reply to: 204170332 [](ancestors = 204170332,203896122) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I tried using BaseUrl but it fails in multiple cases when the baseurl is the $metadata url, which is common, among other failing cases. In reply to: 205241623 [](ancestors = 205241623,204170332,203896122) |
||||
|
||||
/// <summary> | ||||
/// Func to evaluate whether an annotation should be read or skipped by the reader. The func should return true if the annotation should | ||||
/// be read and false if the annotation should be skipped. A null value indicates that all annotations should be skipped. | ||||
|
@@ -262,6 +267,7 @@ private void CopyFrom(ODataMessageReaderSettings other) | |||
this.validations = other.validations; | ||||
this.ThrowOnDuplicatePropertyNames = other.ThrowOnDuplicatePropertyNames; | ||||
this.ThrowIfTypeConflictsWithMetadata = other.ThrowIfTypeConflictsWithMetadata; | ||||
this.RequestUri = other.RequestUri; | ||||
this.ThrowOnUndeclaredPropertyForNonOpenType = other.ThrowOnUndeclaredPropertyForNonOpenType; | ||||
this.LibraryCompatibility = other.LibraryCompatibility; | ||||
this.Version = other.Version; | ||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What will happen if contextUriFromPayload is absolute? I'm reading the API here and it says that the second Uri is relative. #ByDesign
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe it might be some doc issue. The actual implementation of Uri.TryCreate(Uri, string, out Uri) first tries to convert the string to absolute uri first if possible; otherwise it tries to use the baseUri to resolve the string representing relative url to get the result. See here: https://github.com/Microsoft/referencesource/blob/master/System/net/System/UriExt.cs#L315
Added inline comment.
In reply to: 202220739 [](ancestors = 202220739)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for looking into this! #ByDesign