Skip to content

Commit

Permalink
Merge pull request #1722 from akto-api-security/hotfix/fix_copy_as_burp
Browse files Browse the repository at this point in the history
fixing regex error
  • Loading branch information
avneesh-akto authored Nov 14, 2024
2 parents 6c1ac0d + 760bd0a commit c4117a8
Showing 1 changed file with 7 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -128,17 +128,15 @@ const editorSetup = {
})
},

findErrors: function(Editor,keywords){
// a key may start with spaces and may have a "-" before starting
// it will end with ":" and may have spaces at the end.
let keyRegex = /^\s*-?\s*(\w+)(?=:( *)$)/
findErrors: function(Editor, keywords){
let keyRegex = /^\s*-?\s*(\w+)\s*:( *)$/;
Editor.onDidChangeModelContent(() => {
const model = Editor.getModel();
const markers = model.getValue().split('\n').flatMap((line, index) => {
let match = keyRegex.exec(line);
const words = [];
if(match!=null){
words.push(match[0]);
if (match != null) {
words.push(match[1]);
}
const errors = words.flatMap((word, wordIndex) => {
const matchingKeywords = keywords.filter(keyword => {
Expand All @@ -156,10 +154,10 @@ const editorSetup = {
});
return errors;
});
editor.setModelMarkers(model, 'keyword-marker-owner', markers)

})
editor.setModelMarkers(model, 'keyword-marker-owner', markers);
});
}


}

Expand Down

0 comments on commit c4117a8

Please sign in to comment.