Skip to content

Commit

Permalink
UrlDecode path
Browse files Browse the repository at this point in the history
  • Loading branch information
chsami committed Jul 31, 2024
1 parent 9638fff commit ef76df7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions MicrobotApi/Controllers/FileController.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Azure;
using System.Web;
using Azure;
using Azure.Storage.Blobs.Models;
using MicrobotApi.Database;
using MicrobotApi.Models;
Expand Down Expand Up @@ -63,6 +64,6 @@ public async Task<IActionResult> Download(string path)
{
var file = await _azureStorageService.DownloadFile(path);

return File(file.Value.Content, "application/octet-stream", Path.GetFileName(path));
return File(file.Value.Content, "application/octet-stream", Path.GetFileName(HttpUtility.UrlDecode(path)));
}
}
2 changes: 1 addition & 1 deletion MicrobotApi/Services/AzureStorageService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public static Uri GetSasUri(BlobBaseClient blobClient)
public Task<Response<BlobDownloadInfo>> DownloadFile(string storagePath)
{
var containerClient = _blobServiceClient.GetBlobContainerClient(BlobContainer);
var blobClient = containerClient.GetBlobClient(storagePath);
var blobClient = containerClient.GetBlobClient(HttpUtility.UrlDecode(storagePath));

var blobData = blobClient.DownloadAsync();

Expand Down

0 comments on commit ef76df7

Please sign in to comment.