diff options
| author | Shinigami <[email protected]> | 2023-02-04 21:57:45 +0100 |
|---|---|---|
| committer | GitHub <[email protected]> | 2023-02-04 21:57:45 +0100 |
| commit | 667599d8fb59c31166b897799f30788edc5f54d7 (patch) | |
| tree | 16f7adf85aa1797faa9d046efe2bda09b6476080 /src/modules/git | |
| parent | 8e4526df4430721c53cffa8082b72707eea1ccc5 (diff) | |
| download | faker-667599d8fb59c31166b897799f30788edc5f54d7.tar.xz faker-667599d8fb59c31166b897799f30788edc5f54d7.zip | |
fix(git): commitEntry normalize user (#1813)
Diffstat (limited to 'src/modules/git')
| -rw-r--r-- | src/modules/git/index.ts | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/modules/git/index.ts b/src/modules/git/index.ts index 05d24f71..394f9610 100644 --- a/src/modules/git/index.ts +++ b/src/modules/git/index.ts @@ -109,9 +109,12 @@ export class GitModule { const lastName = this.faker.person.lastName(); const fullName = this.faker.person.fullName({ firstName, lastName }); const username = this.faker.internet.userName(firstName, lastName); - const user = this.faker.helpers.arrayElement([fullName, username]); + let user = this.faker.helpers.arrayElement([fullName, username]); const email = this.faker.internet.email(firstName, lastName); + // Normalize user according to https://github.com/libgit2/libgit2/issues/5342 + user = user.replace(/^[\.,:;"\\']|[\<\>\n]|[\.,:;"\\']$/g, ''); + lines.push( `Author: ${user} <${email}>`, `Date: ${this.commitDate({ refDate })}`, |
