Skip to content

Commit

Permalink
Use current working directory to resolve file path
Browse files Browse the repository at this point in the history
  • Loading branch information
MaggieKimani1 committed Oct 1, 2024
1 parent f04d45e commit 5046131
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/Microsoft.OpenApi/Reader/Services/DefaultStreamLoader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,16 @@ public Stream Load(Uri uri)
/// <exception cref="ArgumentException"></exception>
public async Task<Stream> LoadAsync(Uri uri)
{
var absoluteUri = new Uri(baseUrl, uri);
Uri absoluteUri;
if (baseUrl.Equals(OpenApiConstants.BaseRegistryUri))

Check failure

Code scanning / CodeQL

Equals on incomparable types Error

Call to 'Equals()' comparing incomparable types
Uri
and
String
.
{
// use current working directory
absoluteUri = new Uri(Directory.GetCurrentDirectory() + uri);
}
else
{
absoluteUri = new Uri(baseUrl, uri);
}

Check notice

Code scanning / CodeQL

Missed ternary opportunity Note

Both branches of this 'if' statement write to the same variable - consider using '?' to express intent better.

switch (absoluteUri.Scheme)
{
Expand Down

0 comments on commit 5046131

Please sign in to comment.