Automattic/photon.js — pull request #2 by rralian (2014-12-20 17:27:44+00:00)
Title: fixes photonception issue

I noticed two issues. The first is that the photon subdomain for the image in the photon-ception test seems to be incorrect. If I feed
> http://www.gravatar.com/avatar/693307b4e0cb9366f34862c9dfacd7fc

into photon, it returns

> https://i0.wp.com/www.gravatar.com/avatar/693307b4e0cb9366f34862c9dfacd7fc

and not

> https://i1.wp.com/www.gravatar.com/avatar/693307b4e0cb9366f34862c9dfacd7fc

as the test was running against. Fixing that shows that the test fails and photon-ception is still possible. And that's because when generating the photon server (`i0`, `i1`, or `i2`), we were not first removing the possible pre-pended photon subdomain. So in this case we were determining the photon subdomain from
> i1.wp.com/www.gravatar.com/avatar/693307b4e0cb9366f34862c9dfacd7fc

instead of
> www.gravatar.com/avatar/693307b4e0cb9366f34862c9dfacd7fc

So I'm also stripping any possible photon subdomain before generating the resulting subdomain, so we're comparing apples to apples.