File tree Expand file tree Collapse file tree 1 file changed +24
-1
lines changed Expand file tree Collapse file tree 1 file changed +24
-1
lines changed Original file line number Diff line number Diff line change @@ -1314,7 +1314,28 @@ public static async Task<JObject> LoadConfigurationAsync(string configurationFil
13141314
13151315 localconfiguration = null ;
13161316
1317- switch ( Path . GetExtension ( configurationFilenameOrUrl ) )
1317+ string configurationExtension = null ;
1318+
1319+ if ( configurationFilenameOrUrl . StartsWith ( "http" , StringComparison . OrdinalIgnoreCase ) )
1320+ {
1321+ // Remove any query string to detect the correct extension
1322+ var questionMarkIndex = configurationFilenameOrUrl . IndexOf ( "?" ) ;
1323+ if ( questionMarkIndex != - 1 )
1324+ {
1325+ var filename = configurationFilenameOrUrl . Substring ( 0 , questionMarkIndex ) ;
1326+ configurationExtension = Path . GetExtension ( filename ) ;
1327+ }
1328+ else
1329+ {
1330+ configurationExtension = Path . GetExtension ( configurationFilenameOrUrl ) ;
1331+ }
1332+ }
1333+ else
1334+ {
1335+ configurationExtension = Path . GetExtension ( configurationFilenameOrUrl ) ;
1336+ }
1337+
1338+ switch ( configurationExtension )
13181339 {
13191340 case ".json" :
13201341 localconfiguration = JObject . Parse ( configurationContent ) ;
@@ -1333,6 +1354,8 @@ public static async Task<JObject> LoadConfigurationAsync(string configurationFil
13331354 var json = serializer . Serialize ( yamlObject ) ;
13341355 localconfiguration = JObject . Parse ( json ) ;
13351356 break ;
1357+ default :
1358+ throw new DriverException ( $ "Unsupported configuration format: { configurationExtension } ") ;
13361359 }
13371360
13381361 // Process imports
You can’t perform that action at this time.
0 commit comments