Note to self: we do this twice and should factor it out and then upstream it to the *URL* module implementation.