Skip to content

Commit e837e86

Browse files
committed
Added check for uris with query parameters to prevent double encoding of the http request.
1 parent d6bd512 commit e837e86

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

src/Authentication/Authentication/Cmdlets/InvokeMgGraphRequest.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -402,8 +402,7 @@ private Uri PrepareUri(HttpClient httpClient, Uri uri)
402402
// set body to null to prevent later FillRequestStream
403403
Body = null;
404404
}
405-
// TODO: Review the fix made in https://github.com/microsoftgraph/msgraph-sdk-powershell/pull/2455.
406-
return uriBuilder.Uri;
405+
return uriBuilder.Uri.EscapeDataStrings();
407406
}
408407

409408
private void ThrowIfError(ErrorRecord error)

src/Authentication/Authentication/Helpers/EncodeUriPath.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ public static class EncodeUriPaths
1515
{
1616
public static Uri EscapeDataStrings(this Uri uri)
1717
{
18+
if(uri.Query.Length > 0)
19+
return uri;
1820
int counter = 0;
1921
var pathSegments = uri.OriginalString.Split('/');
2022
StringBuilder sb = new StringBuilder();

0 commit comments

Comments
 (0)