Skip to content

Commit 198f93a

Browse files
committed
Fix loading on linux
1 parent e348679 commit 198f93a

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

src/Microsoft.OpenApi/Reader/Services/DefaultStreamLoader.cs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,10 @@ public DefaultStreamLoader(HttpClient httpClient)
3131
/// <inheritdoc/>
3232
public async Task<Stream> LoadAsync(Uri baseUrl, Uri uri, CancellationToken cancellationToken = default)
3333
{
34-
var absoluteUri = (baseUrl.AbsoluteUri.Equals(OpenApiConstants.BaseRegistryUri), baseUrl.IsAbsoluteUri, uri.IsAbsoluteUri) switch
34+
var absoluteUri = baseUrl.AbsoluteUri.Equals(OpenApiConstants.BaseRegistryUri) switch
3535
{
36-
(true, _, _) => new Uri(Path.Combine(Directory.GetCurrentDirectory(), uri.ToString())),
37-
// this overcomes a URI concatenation issue for local paths on linux OSes
38-
(_, true, false) when baseUrl.Scheme.Equals("file", StringComparison.OrdinalIgnoreCase) && !RuntimeInformation.IsOSPlatform(OSPlatform.Windows) =>
39-
new Uri(Path.Combine(baseUrl.AbsoluteUri, uri.ToString())),
40-
(_, _, _) => new Uri(baseUrl, uri),
36+
true => new Uri(Path.Combine(Directory.GetCurrentDirectory(), uri.ToString())),
37+
_ => new Uri(baseUrl, uri),
4138
};
4239

4340
return absoluteUri.Scheme switch

0 commit comments

Comments
 (0)