Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@
<LangVersion>9.0</LangVersion>
<TargetFrameworks>netstandard2.0;net6.0;net472</TargetFrameworks>
<RootNamespace>Microsoft.Graph.PowerShell.Authentication.Core</RootNamespace>
<Version>2.6.1</Version>
<Version>2.18.0</Version>
</PropertyGroup>
<PropertyGroup>
<EnableNETAnalyzers>true</EnableNETAnalyzers>
<EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Azure.Identity" Version="1.11.0" />
<PackageReference Include="Azure.Identity.Broker" Version="1.0.0-beta.5" />
<PackageReference Include="Azure.Identity.Broker" Version="1.1.0" />
<PackageReference Include="Microsoft.Graph.Core" Version="3.0.9" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -402,8 +402,7 @@ private Uri PrepareUri(HttpClient httpClient, Uri uri)
// set body to null to prevent later FillRequestStream
Body = null;
}
// TODO: Review the fix made in https://github.com/microsoftgraph/msgraph-sdk-powershell/pull/2455.
return uriBuilder.Uri;
return uriBuilder.Uri.EscapeDataStrings();
}

private void ThrowIfError(ErrorRecord error)
Expand Down
16 changes: 14 additions & 2 deletions src/Authentication/Authentication/Helpers/EncodeUriPath.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,25 @@ public static Uri EscapeDataStrings(this Uri uri)
int counter = 0;
var pathSegments = uri.OriginalString.Split('/');
StringBuilder sb = new StringBuilder();
foreach (var segment in pathSegments)
foreach (var s in pathSegments)
{
var segment = s;
//Skips the left part of the uri i.e https://graph.microsoft.com
if (counter > 2)
{
sb.Append('/');
sb.Append(Uri.EscapeDataString(segment));
if(s.Contains("?"))
{
var queryStringIndex = segment.IndexOf("?");
string queryString = segment.Substring(queryStringIndex);
segment = s.Substring(0, queryStringIndex);
sb.Append(Uri.EscapeDataString(segment));
sb.Append(queryString);
}
else
{
sb.Append(Uri.EscapeDataString(segment));
}
}
counter++;
}
Expand Down