Skip to content

Commit

Permalink
clarify authority requirement
Browse files Browse the repository at this point in the history
  • Loading branch information
bpasero committed Sep 24, 2020
1 parent 7347078 commit e2316cf
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions src/vs/base/common/network.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,25 +133,24 @@ class RemoteAuthoritiesImpl {
}
}

const vscodeFileResourceAuthority = 'app';
export const RemoteAuthorities = new RemoteAuthoritiesImpl();

class LocalFileAccessImpl {
rewrite(uri: URI): URI {
rewrite(uri: URI, query?: string): URI {
return uri.with({
scheme: Schemas.vscodeFileResource,
authority: vscodeFileResourceAuthority
// We need to provide an authority here so that it can serve
// as origin for network and loading matters in chromium.
authority: 'app',
query
});
}
}

export const RemoteAuthorities = new RemoteAuthoritiesImpl();
export const LocalFileAccess = new LocalFileAccessImpl();

export function toCodeFileUri(path: string, query?: string): URI {
const url = require.toUrl(path);
return URI.parse(url).with({
scheme: Schemas.vscodeFileResource,
authority: vscodeFileResourceAuthority,
query
});

return LocalFileAccess.rewrite(URI.parse(url), query);
}

0 comments on commit e2316cf

Please sign in to comment.