MediaLibrary file upload with space in name

Topics: General
Apr 3, 2014 at 8:25 PM
Hi All

I'm setting up a v1.8 site and noticed that when images are imported into the media library using the upload features the images are successfully uploaded to the Media folder however he thumbnail for the image returns a 404. After some further investigation it appears when the Media Profile is created it is replacing spaces in the filename with URL encoding (%20).

Original file: "Photo 2.jpg"
Media: "Photo 2.jpg"
_Profiles\1338a03e\5da91da8: "Photo%202.jpg"

It seems like a bug to me but wanted confirmation from someone else before I raise an issue.


Apr 10, 2014 at 1:58 PM
In module OrchardMediaProcessing > Services > ImageProfileManager.cs

line 138: (GetImageProfileUrl(...))
var newFile = _storageProvider.OpenOrCreate(filterContext.FilePath);

var newFile = _storageProvider.OpenOrCreate(System.Web.HttpUtility.UrlEncode(filterContext.FilePath));

I think it works because the profiled image was saved with %20 instead of space...
Apr 13, 2014 at 6:55 AM
Edited Apr 13, 2014 at 6:56 AM
following observation might help also:
when testing around 'Media' in 1.8 ( a freshly downloaded version from CodePlex) I realise that any image name conataining a 'blank' is NOT shown (i.e. only a cross(X)).
in Dashboard --> Media Library: when importing or when opening a media folder I ONLY get the cross! (e.g. 'My Image.jpg' shown as 'My%20Image.jpg').

When comparing the profiles: In 1.8 I have 'My%20Image.jpg'; BEFORE 1.8 I see that all the names are 'constructed' using underscores () ...!
PS: urbanit's code change did NOT help in my case

What am I missing here; what should/can I do? ... or is this a bug!?

thanks for your time and hints, ed