Skip to content

Commit

Permalink
Work Item #405: Use Gravatar's secure URL when using SSL.
Browse files Browse the repository at this point in the history
  • Loading branch information
pranavkm committed Jul 25, 2012
1 parent 5aee8b7 commit d79a2c8
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions Website/App_Code/ViewHelpers.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,12 @@
}

@helper GravatarImage(string email, string username, int size) {
<text>
@Gravatar.GetHtml(email, size, "retro", GravatarRating.G, attributes: new { width = size, height = size, title = username, @class = "owner-image" })
</text>
var gravatarHtml = Gravatar.GetHtml(email, size, "retro", GravatarRating.G, attributes: new { width = size, height = size, title = username, @class = "owner-image" });
if (gravatarHtml != null && Request.IsSecureConnection)

This comment has been minimized.

Copy link
@jeffhandley

jeffhandley Jul 25, 2012

Member

I know there are hosts (AppHarbor for instance) where IsSecureConnection will be false because of being behind a reverse proxy, but if someone else who hosts the gallery is affected, they can issue a pull request to make this code still work in those cases.

{
gravatarHtml = new HtmlString(gravatarHtml.ToHtmlString().Replace("http://www.gravatar.com/", "https://secure.gravatar.com/"));
}
@gravatarHtml
}

@helper ReleaseTag(){
Expand Down

3 comments on commit d79a2c8

@osbornm
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sad panda we should fix the helper :) But looks good :shipit:

@jeffhandley
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit:

@pranavkm
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@osbornm Like you'd ever get the lazy-ass owner of that code to ever fix that bug :p

Please sign in to comment.