Skip to content

Commit 1dcf1bd

Browse files
committed
Copies only known properties from autolinks
Refs #2037
1 parent 0e68be4 commit 1dcf1bd

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

src/annotations/autolinks.ts

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,21 @@ export class Autolinks implements Disposable {
6363
if (configuration.changed(e, 'autolinks')) {
6464
const autolinks = configuration.get('autolinks');
6565
// Since VS Code's configuration objects are live we need to copy them to avoid writing back to the configuration
66-
this._references = autolinks != null ? autolinks.map(a => ({ ...a })) : [];
66+
this._references =
67+
autolinks
68+
?.filter(a => a.prefix && a.url)
69+
/**
70+
* Only allow properties defined by {@link AutolinkReference}
71+
*/
72+
?.map(a => ({
73+
prefix: a.prefix,
74+
url: a.url,
75+
title: a.title,
76+
alphanumeric: a.alphanumeric,
77+
ignoreCase: a.ignoreCase,
78+
type: a.type,
79+
description: a.description,
80+
})) ?? [];
6781
}
6882
}
6983

0 commit comments

Comments
 (0)