abstract sanitizeURL function, unit tests