Issue downloading file with + signs in their name, from Azure Blob Storage, in Azure App Service

sekou keita 20 Reputation points
2023-12-04T17:58:41.95+00:00

I am experiencing an issue downloading a file with a + sign in its name (

14595-2023-2157-1-GCSU+Tree+Campus+Plan+2022 .docx

), specifically when my code is deployed in Azure App Service. Surprisingly, the file exists in Blob Storage and can be downloaded when my web API is run locally. Attempting to download the file when my API is deployed in Azure App Service results in the error message:

The resource you are looking for has been removed, had its name changed, or is temporarily unavailable.

However, there is no issue both locally and deployed for files whose names do not contain the + sign. I tried to identify if there are any encoding or decoding issues by adding many logs into the action method, but it seems that the endpoint is not hit on deployment. Here is my action method:

  • Visual Studio: 2022, version 17.8.2
  • ASP.NET Core 6.0 Web API
// GET: /files/fileName [HttpGet("{fileName}")]
public async Task
ASP.NET Core
ASP.NET Core
A set of technologies in the .NET Framework for building web applications and XML web services.
4,803 questions
Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
8,501 questions
0 comments No comments
{count} votes

Accepted answer
  1. Sumarigo-MSFT 47,516 Reputation points Microsoft Employee
    2024-02-05T04:58:52.5133333+00:00

    @sekou keita I'm glad that you were able to resolve your issue and thank you for posting your solution so that others experiencing the same thing can easily reference this! Since the Microsoft Q&A community has a policy that "The question author cannot accept their own answer. They can only accept answers by others ", I'll repost your solution in case you'd like to "Accept " the answer.

    Issue: Issue downloading file with + signs in their name, from Azure Blob Storage, in Azure App Service

    Solution: I resolved the issue by modifying my file naming convention. Initially, I used the file name as a path parameter ("/baseurl/files/{filename}"). However, I addressed the problem by switching to a query parameter approach ("/baseurl/files?filename={filename}"). I hope this adjustment can also resolve any similar issues

    ---Please remember to "Accept Answer" if any answer/reply helped, so that others in the community facing similar issues can easily find the solution.

    1 person found this answer helpful.

6 additional answers

Sort by: Most helpful
  1. sekou keita 20 Reputation points
    2024-01-22T12:11:54.8966667+00:00

    I had my file name as path parameter. I fixed my issue by using query parameter. For example, I had "/baseurl/files/{filename}". I changed it to " /baseurl/files?filename={filename}. I hope that will solve your issue as well.

    0 comments No comments

  2. Pinaki Ghatak 5,575 Reputation points Microsoft Employee
    2024-01-24T15:54:35.5766667+00:00

    Hello @sekou keita The issue you’re facing might be related to the encoding of special characters in file names. The ‘+’ character is a reserved character in URLs and needs to be properly encoded. In URLs, ‘+’ is often interpreted as a space.

    When you’re working with Azure Blob Storage, the blob names are case-sensitive and reserved URL characters must be properly escaped. If you’re trying to access a file with a ‘+’ in its name, it might be getting interpreted as a space, leading to a file not found error.

    You could try encoding the ‘+’ sign as ‘%2B’ in your file names when storing and accessing them in Azure Blob Storage. This might resolve the issue you’re facing. If you’re using the AzCopy command-line utility to download blobs, you can append a SAS token to the resource URL in each AzCopy command for authorization.

    If the issue persists, it might be helpful to check if there are any concurrency issues causing uncommitted blocks.

    Please remember to always encode the special characters in your file names when working with Azure Blob Storage to avoid such issues. I hope this solves your issue.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.