Skip to content

Commit 1a3ad57

Browse files
committed
Add output of malicious extensions to malicious.json
As per the feedback from the PR readd the output of malicious extensions to the "malicious.json". The file is used by VS Code itself so there are no ther references to the file in the source code.
1 parent ba99907 commit 1a3ad57

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

vscoffline/sync.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -476,7 +476,7 @@ def get_recommendations_old(self, destination):
476476

477477
return packages
478478

479-
def get_malicious(self, extensions=None):
479+
def get_malicious(self, destination, extensions=None):
480480
if not extensions:
481481
return
482482

@@ -492,6 +492,11 @@ def get_malicious(self, extensions=None):
492492
'utf-8', 'ignore').replace(u'\xa0', u'')
493493
jresult = json.loads(stripped)
494494

495+
# Output to malicious.json (used by VS Code)
496+
with open(os.path.join(destination, 'malicious.json'), 'w') as outfile:
497+
json.dump(jresult, outfile, cls=vsc.MagicJsonEncoder, indent=4)
498+
499+
# Remove malicious extensions from collection
495500
for extension in (extensions.copy()):
496501
if extension in jresult['malicious']:
497502
log.warning(
@@ -960,7 +965,7 @@ def __repr__(self):
960965
if config.updatemalicious:
961966
log.info('Syncing VS Code Malicious Extension List')
962967
malicious = mp.get_malicious(
963-
extensions)
968+
os.path.abspath(config.artifactdir), extensions)
964969

965970
if config.updateextensions:
966971
log.info(

0 commit comments

Comments
 (0)