Orchard icon indicating copy to clipboard operation
Orchard copied to clipboard

Media Library + Azure: illegal characters causing various problems

Open BenedekFarkas opened this issue 9 years ago • 1 comments

Windows (NTFS) prohibits the use of the following characters in file and folder names: ", *, :, <, >, ?, |, /, \.

Due to the differences in how files are stored in Azure Blob Storage (including the Development Storage of the Storage Emulator) most of these are actually accepted when renaming files in the Media Library when using Microsoft Azure Media Storage:

  • ", <, >, |: Server error when calling the API to query media items ("Illegal characters in path."). For some of the illegal characters, the file name is changed up until the illegal character, but the rest of it is cut off. This error renders the Media Library unusable when opening a folder that contains an affected file.
  • *, :, ?: The file can't be downloaded to the local file system without changing its name (also true for the previous set of characters).
  • /: Creates a folder for each slash in the file name (and displayed as such in the Media Library navigation) and the file is at the bottom of the folder structure created by those slashes, but the file is displayed in the correct folder (where it was actually uploaded) in the Media Library (with a file name that has the folder structure defined by the slashes cut off).
  • \: This is the only illegal character that is handled correctly: A validation error is displayed when saving the file.

Suggestion: Trigger a validation error for all illegal characters.

BenedekFarkas avatar Apr 12 '16 15:04 BenedekFarkas

Besides having added a bunch of characters, in #7577 I added a validation to the FileSystemStorageProvider to further prevent invalid characters in the path. Something similar could be done for Azure. It should be straightforward, but I am not volunteering because we don't use Azure storage and I would have no way to test or validate this.

MatteoPiovanelli avatar Aug 27 '19 08:08 MatteoPiovanelli