Dinesh Kumar
Dinesh Kumar

Reputation: 127

Do we have list of unsupported characters for azure blob file names?

I'm uploading some files with some different special characters to the blob. It is not getting uploaded. I found that there is some restriction on naming the files of the azure. So I need the list of unsupported unicode characters for blob file names or way to find whether a character is supported in azure blob file name or not.

I had referred below doc on this. They didnt provide any particular list or way to find it. https://learn.microsoft.com/en-us/rest/api/storageservices/naming-and-referencing-shares--directories--files--and-metadata

I need the exact validation of file name validation happening on upload file blade on azure blob

Upvotes: 4

Views: 18546

Answers (3)

Nick Craig-Wood
Nick Craig-Wood

Reputation: 54089

I don't think the Microsoft Docs are very precisely specified.

A blob name must conforming to the following naming rules:

  • A blob name can contain any combination of characters.
  • A blob name must be at least one character long and cannot be more than 1,024 characters long, for blobs in Azure Storage.
  • Blob names are case-sensitive.
  • Reserved URL characters must be properly escaped.
  • The number of path segments comprising the blob name cannot exceed 254. A path segment is the string between consecutive delimiter characters (e.g., the forward slash '/') that corresponds to the name of a virtual directory.

In my tests I found you cannot have these characters in an Azure Blob name

  • Control characters 0x00-0x1F
  • Delete 0x7F
  • Backslash '\' - Azure converts this to forward slash '/'
  • Names ending in full stop '.'

I used the Azure Blob go SDK for doing these tests, so it is possible some of these limitations are due to that.

Upvotes: 5

Zhaoxing Lu
Zhaoxing Lu

Reputation: 6467

Here is the correct document: https://learn.microsoft.com/en-us/rest/api/storageservices/naming-and-referencing-containers--blobs--and-metadata#blob-names

A blob name must conforming to the following naming rules:

  • A blob name can contain any combination of characters.

  • A blob name must be at least one character long and cannot be more than 1,024 characters long, for blobs in Azure Storage.

    The Azure Storage emulator supports blob names up to 256 characters long. For more information, see Use the Azure storage emulator for development and testing.

  • Blob names are case-sensitive.

  • Reserved URL characters must be properly escaped.

  • The number of path segments comprising the blob name cannot exceed 254. A path segment is the string between consecutive delimiter characters (e.g., the forward slash '/') that corresponds to the name of a virtual directory.

Note: Avoid blob names that end with a dot (.), a forward slash (/), or a sequence or combination of the two.

The Blob service is based on a flat storage scheme, not a hierarchical scheme. However, you may specify a character or string delimiter within a blob name to create a virtual hierarchy. For example, the following list shows valid and unique blob names. Notice that a string can be valid as both a blob name and as a virtual directory name in the same container:

  • /a

  • /a.txt

  • /a/b

  • /a/b.txt

You can take advantage of the delimiter character when enumerating blobs.

Note: the doc that was mentioned in your question is for Azure File Storage rather than Azure Blob Storage, so it's not the correct one.

Upvotes: 0

Related Questions