Couldn't this use the `isSameOriginUrl` function from `utils`?