Skip to content

Commit

Permalink
Munge more Gravatar urls into https submission
Browse files Browse the repository at this point in the history
This is based on idly scanning
http://explorer.metacpan.org/#/693f90463a5e4980272a by hand.
  • Loading branch information
tsibley committed May 27, 2014
1 parent d500bba commit 964250a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
5 changes: 4 additions & 1 deletion lib/MetaCPAN/Web/View/HTML.pm
Expand Up @@ -179,7 +179,10 @@ Template::Alloy->define_vmethod(
'text',
gravatar_fixup => sub {
my ( $url, $size ) = @_;
if ( $url =~ m{^https?://(secure|www)\.gravatar\.com/avatar/} ) {
if ( $url
=~ m{^https?://([a-z0-9.-]+\.)?gravatar\.com/(avatar|userimage)/}i
)
{
my $url = URI->new($url);
$url->scheme('https');
$url->host('secure.gravatar.com');
Expand Down
5 changes: 3 additions & 2 deletions root/static/js/contributors.js
Expand Up @@ -13,8 +13,9 @@ $(function(){
// TODO make this an :before pseudo-class
var gravatar = data.gravatar_url;
gravatar = gravatar.replace(
"^http://(www\.)?gravatar.com/",
"https://secure.gravatar.com/"
"^https?://([a-z0-9.-]+\.)?gravatar\.com/",
"https://secure.gravatar.com/",
"i"
).replace(
/s=\d+/,
's=20'
Expand Down

0 comments on commit 964250a

Please sign in to comment.