Skip to content

Commit

Permalink
Use enescaped string when calling Azure BlobClient
Browse files Browse the repository at this point in the history
  • Loading branch information
ericstj committed Nov 19, 2024
1 parent 4292dd2 commit 426fb0a
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/SourceBrowser/src/SourceIndexServer/Helpers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace Microsoft.SourceBrowser.SourceIndexServer
{
public static class Helpers
{
public static async Task ProxyRequestAsync(this HttpContext context, string targetPath, Action<HttpRequestMessage> configureRequest = null)
private static async Task ProxyRequestAsync(this HttpContext context, string targetPath, Action<HttpRequestMessage> configureRequest = null)
{
var fs = new AzureBlobFileSystem(IndexProxyUrl);
var props = fs.FileProperties(targetPath);
Expand All @@ -24,15 +24,15 @@ public static async Task ProxyRequestAsync(this HttpContext context, string targ
}
}

private static bool UrlExists(string proxyRequestPath)
private static bool FileExists(string proxyRequestPath)
{
var fs = new AzureBlobFileSystem(IndexProxyUrl);
return fs.FileExists(proxyRequestPath);
}

public static async Task ServeProxiedIndex(HttpContext context, Func<Task> next)
{
var path = context.Request.Path.ToUriComponent();
var path = context.Request.Path.Value;

if (!path.EndsWith(".html", StringComparison.Ordinal) && !path.EndsWith(".txt", StringComparison.Ordinal))
{
Expand All @@ -49,7 +49,7 @@ public static async Task ServeProxiedIndex(HttpContext context, Func<Task> next)

var proxyRequestPathSuffix = (path.StartsWith("/", StringComparison.Ordinal) ? path : "/" + path).ToLowerInvariant();

if (!UrlExists(proxyRequestPathSuffix))
if (!FileExists(proxyRequestPathSuffix))
{
await next().ConfigureAwait(false);
return;
Expand Down

0 comments on commit 426fb0a

Please sign in to comment.