Skip to content

Commit

Permalink
fix: overly permissive regex
Browse files Browse the repository at this point in the history
  • Loading branch information
KatoakDR committed Dec 29, 2023
1 parent 16947d0 commit 46297f6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion electron/common/string/string.utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ const UNESCAPABLE_ENTITIES: Record<string, string> = {
amp: '&',
};

const UNESCAPE_ENTITIES_REGEX = /&([A-z]+);/g;
const UNESCAPE_ENTITIES_REGEX = /&([a-zA-Z]+);/g;

/**
* Unescapes XML entities.
Expand Down
4 changes: 2 additions & 2 deletions electron/main/game/game.parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ const START_TAG_NAME_REGEX = /^<([^\s>/]+)/;
* Matches all the key="value" pairs in a start tag.
* For each match, the first captured group is the attribute name
* and the third captured group is the attribute value.
* https://regex101.com/r/lj4WgD/1
* https://regex101.com/r/d76B05/1
*/
const START_TAG_ATTRIBUTES_REGEX = /([A-z][A-z0-9_-]*)=(["'])(.*?)\2/g;
const START_TAG_ATTRIBUTES_REGEX = /([a-zA-Z][\w-]*)=(["'])(.*?)\2/g;

/**
* Match the entirety of an end tag.
Expand Down

0 comments on commit 46297f6

Please sign in to comment.