Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions ng-dev/release/snapshot-publish/snapshots.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,9 +161,16 @@ export class SnapshotPublisher {
['diff-index', '--quiet', '-I', '0\\.0\\.0-[a-f0-9]+', 'HEAD', '--'],
{cwd: tmpRepoDir},
).status === 1;
this.git.run(['commit', '--author', this.commitAuthor, '-m', this.snapshotCommitMessage], {
cwd: tmpRepoDir,
});
this.git.run(
[
'commit',
'--author',
this.commitAuthor,
'-m',
`"${this.snapshotCommitMessage.replace(/"/g, '\\"')}"`,
],
{cwd: tmpRepoDir},
);
Comment on lines +164 to +173
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The added escaping of double quotes and wrapping the message in quotes is not necessary and is likely to cause issues. The git.run method uses child_process.spawnSync which, when given an array of arguments, passes them directly to the git executable without an intermediate shell. This means shell-style quoting is not needed.

With this change, if snapshotCommitMessage is feat: handle "quotes", the actual commit message will become "feat: handle \"quotes\"", including the outer quotes and the backslash, which is not the intended behavior.

The original implementation was correct. Please revert this part of the change.

        this.git.run(['commit', '--author', this.commitAuthor, '-m', this.snapshotCommitMessage], {
          cwd: tmpRepoDir,
        });


return {
url,
Expand Down
Loading