diff --git a/lib/cli/scripts/changelog.ts b/lib/cli/scripts/changelog.ts index 2dff31ddf2..183b12d35a 100644 --- a/lib/cli/scripts/changelog.ts +++ b/lib/cli/scripts/changelog.ts @@ -109,12 +109,12 @@ function getCommits(options: DiffOptions): Array { 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 {