Be smarter about fixing misconfigured URLs

In cases where we were being handed URLs that started with // we were adding an extra http://, resulting in http://// prefixes. 

Also made safer here: the call to decodeURIComponent, which had no try/catch block around it.