If prefsUrl has already a trailing slash, replaceUrl will have 2 trailing slashes. Should use uri /
That function won't work due to the context they're used in, but slashes can definitely be stripped