Description
The build-commit.js file includes this implementation:
const escapeSpecialChars = (result) => {
// eslint-disable-next-line no-useless-escape, prettier/prettier
const specialChars = ['`', '"', '\\$', '!', '<', '>', '&']
let newResult = result
specialChars.forEach((item) => {
// If user types `feat: "string"`, the commit preview should show `feat: \"string\"`.
// Don't worry. The git log will be `feat: "string"`
newResult = newResult.replace(new RegExp(item, 'g'), `\\${item}`)
})
return newResult
}
This code includes this comment:
// If user types `feat: "string"`, the commit preview should show `feat: \"string\"`.
// Don't worry. The git log will be `feat: "string"`
However, when using angle brackets < and >, the \ are still displayed in the git log.
Example
When including a Co-Authored-By trailer in my commit:
Co-Authored-By: Abeba NGWE <abeba.ngwe@example.com>
Here is the result:
| Stage |
Result |
| Preview |
Co-Authored-By: Abeba NGWE \<abeba.ngwe@example.com\> |
| Git log |
Co-Authored-By: Abeba NGWE \<abeba.ngwe@example.com\> |
The backslashes remain in the actual git commit message for < and >, breaking the standard Co-Authored-By format.
How can this be fixed, @leonardoanalista?
Versions
- cz-customizable: 7.5.4
- Node: v22.x
- OS: macOS
Description
The build-commit.js file includes this implementation:
This code includes this comment:
However, when using angle brackets
<and>, the\are still displayed in the git log.Example
When including a
Co-Authored-Bytrailer in my commit:Here is the result:
Co-Authored-By: Abeba NGWE \<abeba.ngwe@example.com\>Co-Authored-By: Abeba NGWE \<abeba.ngwe@example.com\>The backslashes remain in the actual git commit message for
<and>, breaking the standardCo-Authored-Byformat.How can this be fixed, @leonardoanalista?
Versions