Bug: Orchard.MediaProcessing stores UrlEncoded paths, and retrieves urldecoded


This is not a duplicate of

In ImageProfileManager.cs:GetImagProfileUrl,
there has been a change to get the filename using the decoded path
var filePath = _fileNameProvider.GetFileName(profileName, System.Web.HttpUtility.UrlDecode(path));

however in the UpdateFileName method the encode path is passed. Therefore this value is not retrieved from the Orchard_MediaProcessing_FileNameRecord table.
This would result in constantly reprocessing of the image profile files (without being necessary)

Current code:
_fileNameProvider.UpdateFileName(profileName, path, filterContext.FilePath);

we believe this needs to be the decoded path as well (to be consistent with the GetFileName method
_fileNameProvider.UpdateFileName(profileName, System.Web.HttpUtility.UrlDecode(path), filterContext.FilePath);


sebastienros wrote Aug 26, 2014 at 6:14 PM

NetWave wrote Aug 27, 2014 at 8:18 AM

Could be, Sebastien. In our case the image is reprocessed and a new profile image is regenerated. 20177 doesn't mention regeneration.

This only happens if there is a difference between path and UrlDecode(path). We noticed this problem in production because of spaces in the path.

This fix provided by my colleague David Moons solves the problem. _fileNameProvider.GetFileName and _fileNameProvider.UpdateFileName should both be called with the same parameters.

sebastienros wrote Sep 12, 2014 at 1:06 AM

Fixed in changeset 8c9f0692a1cbc6dcc0cfd279707e06d70b62c8ee

NetWave wrote Sep 12, 2014 at 7:43 AM

Perfect, thanks!