Skip to content

Commit 0739b0f

Browse files
author
Benjamin Pasero
committed
url service - create proper URIs
1 parent 9414b7e commit 0739b0f

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

src/vs/platform/url/node/urlService.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,11 @@ import { AbstractURLService } from 'vs/platform/url/common/urlService';
1010
export class URLService extends AbstractURLService {
1111

1212
create(options?: Partial<UriComponents>): URI {
13-
const { authority, path, query, fragment } = options ? options : { authority: undefined, path: undefined, query: undefined, fragment: undefined };
13+
let { authority, path, query, fragment } = options ? options : { authority: undefined, path: undefined, query: undefined, fragment: undefined };
14+
15+
if (authority && path && path.indexOf('/') !== 0) {
16+
path = `/${path}`; // URI validation requires a path if there is an authority
17+
}
1418

1519
return URI.from({ scheme: product.urlProtocol, authority, path, query, fragment });
1620
}

0 commit comments

Comments
 (0)