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