these two lines could just be one

    resolved = resolved.replace(/^resource\:\/([^\/])/, 'resource://$1');