mirror of
https://github.com/ysoftdevs/wapifuzz.git
synced 2026-01-11 14:20:27 +01:00
Handle URI parsing exception
This commit is contained in:
@@ -34,7 +34,7 @@ namespace Parser
|
||||
string basePath = string.Empty;
|
||||
if (openApiDocument.Servers.Any())
|
||||
{
|
||||
basePath = new Uri(openApiDocument.Servers.First().Url).AbsolutePath;
|
||||
basePath = GetUriFromServer(openApiDocument.Servers.First())?.AbsolutePath;
|
||||
}
|
||||
|
||||
if (basePath == "/")
|
||||
@@ -42,5 +42,17 @@ namespace Parser
|
||||
|
||||
return basePath;
|
||||
}
|
||||
|
||||
static Uri GetUriFromServer(OpenApiServer server)
|
||||
{
|
||||
try
|
||||
{
|
||||
return new Uri(server.Url);
|
||||
}
|
||||
catch (UriFormatException)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user