Skip to content

Commit 92cc41e

Browse files
committed
Handle relative paths (microsoft#58694)
1 parent ece59d5 commit 92cc41e

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

extensions/extension-editing/src/extensionLinter.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -291,23 +291,24 @@ export class ExtensionLinter {
291291
}
292292

293293
private addDiagnostics(diagnostics: Diagnostic[], document: TextDocument, begin: number, end: number, src: string, context: Context, info: PackageJsonInfo) {
294+
const hasScheme = /^\w[\w\d+.-]*:/.test(src);
294295
const uri = parseUri(src, info.repository ? info.repository.toString() : document.uri.toString());
295296
if (!uri) {
296297
return;
297298
}
298299
const scheme = uri.scheme.toLowerCase();
299300

300-
if (scheme !== 'https' && scheme !== 'data') {
301+
if (hasScheme && scheme !== 'https' && scheme !== 'data') {
301302
const range = new Range(document.positionAt(begin), document.positionAt(end));
302303
diagnostics.push(new Diagnostic(range, httpsRequired, DiagnosticSeverity.Warning));
303304
}
304305

305-
if (scheme === 'data') {
306+
if (hasScheme && scheme === 'data') {
306307
const range = new Range(document.positionAt(begin), document.positionAt(end));
307308
diagnostics.push(new Diagnostic(range, dataUrlsNotValid, DiagnosticSeverity.Warning));
308309
}
309310

310-
if (!info.hasHttpsRepository) {
311+
if (!hasScheme && !info.hasHttpsRepository) {
311312
const range = new Range(document.positionAt(begin), document.positionAt(end));
312313
let message = (() => {
313314
switch (context) {

0 commit comments

Comments
 (0)