Skip to content

Commit

Permalink
Fix #57897 ignore object valued scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
egamma committed Sep 17, 2018
1 parent cd20626 commit 295f04a
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion extensions/npm/src/tasks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,7 @@ async function findAllScripts(buffer: string): Promise<StringMap> {

let visitor: JSONVisitor = {
onError(_error: ParseErrorCode, _offset: number, _length: number) {
console.log(_error);
},
onObjectEnd() {
if (inScripts) {
Expand All @@ -368,8 +369,10 @@ async function findAllScripts(buffer: string): Promise<StringMap> {
if (property === 'scripts') {
inScripts = true;
}
else if (inScripts) {
else if (inScripts && !script) {
script = property;
} else { // nested object which is invalid, ignore the script
script = undefined;
}
}
};
Expand Down

0 comments on commit 295f04a

Please sign in to comment.