New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sitecore 7.5 Media request protection not supported by GlassHtml.RenderImage #93

Closed
joosthollander opened this Issue Dec 9, 2014 · 4 comments

Comments

Projects
None yet
4 participants
@joosthollander

joosthollander commented Dec 9, 2014

In Sitecore 7.5 media request protection is added. Mediaurls (width w / h parameters) needs to be signed with a hash query string paramater. Since GlassHtml.RenderImage does not go through the renderfield pipeline the urls will not be signed automatically. Further explanation in the 7.5 release notes:
http://sdn.sitecore.net/Products/Sitecore%20V5/Sitecore%20CMS%207/ReleaseNotes/ChangeLog.aspx

Quote:
If you have code in your solution that manually appends image scaling parameters to image URLs without passing the parameters to the sc:image control, you must rewrite the code to append a hash value using one of the helper methods or rewrite it to use the sc:image control. In XSLT renderings, you can use sc:SignMediaUrl(url) or sc:GetSignedMediaUrl(…). In C# code, you can use HashingUtils.ProtectAssetUrl(url) which appends a hash value to the provided URL, or you can use GetAssetUrlHash(url) to only return the hash value for the provided URL.

@mikeedwards83

This comment has been minimized.

Owner

mikeedwards83 commented Dec 9, 2014

Hi

I am aware of this. The fix itself isn't difficult, the bigger problem is
the structure of the Nuget projects. I will need to restructure the
projects so that they are released inline with Sitecore releases numbers
rather than having just on Glass.Mapper.Sc project. This restructure will
take a few weeks to complete.

Mike

On 9 December 2014 at 20:23, joosthollander notifications@github.com
wrote:

In Sitecore 7.5 media request protection is added. Mediaurls (width w / h
parameters) needs to be signed with a hash query string paramater. Since
GlassHtml.RenderImage does not go through the renderfield pipeline the urls
will not be signed automatically. Further explanation in the 7.5 release
notes:

http://sdn.sitecore.net/Products/Sitecore%20V5/Sitecore%20CMS%207/ReleaseNotes/ChangeLog.aspx

Quote:
If you have code in your solution that manually appends image scaling
parameters to image URLs without passing the parameters to the sc:image
control, you must rewrite the code to append a hash value using one of the
helper methods or rewrite it to use the sc:image control. In XSLT
renderings, you can use sc:SignMediaUrl(url) or sc:GetSignedMediaUrl(…). In
C# code, you can use HashingUtils.ProtectAssetUrl(url) which appends a hash
value to the provided URL, or you can use GetAssetUrlHash(url) to only
return the hash value for the provided URL.


Reply to this email directly or view it on GitHub
#93.

@jacksodj

This comment has been minimized.

jacksodj commented Jun 8, 2015

any update on this?

@mikeedwards83

This comment has been minimized.

Owner

mikeedwards83 commented Jun 9, 2015

Hi

This is now supported in V4 so I will close.

Mike

@ashugoyal220

This comment has been minimized.

ashugoyal220 commented Feb 22, 2017

Hi Mike,

I am using upgraded version of Glass mapper 4.0.11.63, Still I am getting the same error "MediaRequestProtection: An invalid/missing hash value was encountered. The expected hash value:"

Is it fixed in any specific version?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment