This is probably worse than the original since you will be undoing URL escaping of components I think. What I meant was to reassemble the new URL using a `URI` constructor, not using any string manipulation at all.