Skip to content

Commit

Permalink
[ACS-5400] Fix incomplete string escaping (#8721)
Browse files Browse the repository at this point in the history
* [ACS-5400] string escaping fix

* [ACS-5400] Unexpected token in json fix
  • Loading branch information
nikita-web-ua committed Jul 29, 2023
1 parent 48898df commit 3125628
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/cli/scripts/changelog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,12 +109,12 @@ function getCommits(options: DiffOptions): Array<Commit> {
let log = shell.exec(command, { cwd: options.dir, silent: true }).toString();

// https://stackoverflow.com/a/13928240/14644447
log = log.trim().replace(/"/gm, '\\"').replace(/\^@\^/gm, '"');
log = JSON.stringify(log.trim()).slice(1, -1).replace(/\^@\^/gm, '"');
if (log.endsWith(',')) {
log = log.substring(0, log.length - 1);
}

return log.split('\n').map(str => JSON.parse(str) as Commit).filter(commit => commitAuthorAllowed(commit, authorFilter));
return log.split('\\n').map(str => JSON.parse(str) as Commit).filter(commit => commitAuthorAllowed(commit, authorFilter));
}

function commitAuthorAllowed(commit: Commit, authorFilter: string): boolean {
Expand Down

0 comments on commit 3125628

Please sign in to comment.