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
1515 {
1616 public static Uri EscapeDataStrings ( this Uri uri )
1717 {
18- if ( uri . Query . Length > 0 )
19- return uri ;
2018 int counter = 0 ;
2119 var pathSegments = uri . OriginalString . Split ( '/' ) ;
2220 StringBuilder sb = new StringBuilder ( ) ;
23- foreach ( var segment in pathSegments )
21+ foreach ( var s in pathSegments )
2422 {
23+ var segment = s ;
2524 //Skips the left part of the uri i.e https://graph.microsoft.com
2625 if ( counter > 2 )
2726 {
2827 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+ }
2936 sb . Append ( Uri . EscapeDataString ( segment ) ) ;
3037 }
3138 counter ++ ;
You can’t perform that action at this time.
0 commit comments