ported expand_url to spice2