I am uploading files from a windows systems to Azure storage blobs
The local file names may contain characters that are invalid in blob names
I need a way of encoding these names as to fulfill the requirements set out by MSDN on blob storage names, as shown below
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.
- 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.
The pertinent information above is "Reserved URL characters must be properly escaped. However, what method is the "standard" to use?
You can use Uri.EscapeUriString(yourStringToEscape)
See docs here
You still have to do the other ones manually i.e the length and path segments .etc.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With