1

Resolved

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

description

This is not a duplicate of
https://orchard.codeplex.com/workitem/20681
nor
http://orchard.codeplex.com/workitem/20598

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);

comments

sebastienros wrote Aug 26 at 6:14 PM

NetWave wrote Aug 27 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 at 1:06 AM

Fixed in changeset 8c9f0692a1cbc6dcc0cfd279707e06d70b62c8ee

NetWave wrote Sep 12 at 7:43 AM

Perfect, thanks!