Factor those two commits out into a normalize_url method.