File tree Expand file tree Collapse file tree 1 file changed +10
-3
lines changed
src/Authentication/Authentication/Helpers Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -15,17 +15,24 @@ public static class EncodeUriPaths
15
15
{
16
16
public static Uri EscapeDataStrings ( this Uri uri )
17
17
{
18
- if ( uri . Query . Length > 0 )
19
- return uri ;
20
18
int counter = 0 ;
21
19
var pathSegments = uri . OriginalString . Split ( '/' ) ;
22
20
StringBuilder sb = new StringBuilder ( ) ;
23
- foreach ( var segment in pathSegments )
21
+ foreach ( var s in pathSegments )
24
22
{
23
+ var segment = s ;
25
24
//Skips the left part of the uri i.e https://graph.microsoft.com
26
25
if ( counter > 2 )
27
26
{
28
27
sb . Append ( '/' ) ;
28
+ if ( s . Contains ( "?" ) )
29
+ {
30
+ var queryStringIndex = segment . IndexOf ( "?" ) ;
31
+ string queryString = segment . Substring ( queryStringIndex ) ;
32
+ segment = s . Substring ( 0 , queryStringIndex ) ;
33
+ sb . Append ( Uri . EscapeDataString ( segment ) ) ;
34
+ sb . Append ( queryString ) ;
35
+ }
29
36
sb . Append ( Uri . EscapeDataString ( segment ) ) ;
30
37
}
31
38
counter ++ ;
You can’t perform that action at this time.
0 commit comments