summaryrefslogtreecommitdiff
path: root/server/common
diff options
context:
space:
mode:
authorJoel Klinghed <the_jk@spawned.biz>2025-06-09 00:49:02 +0200
committerJoel Klinghed <the_jk@spawned.biz>2025-06-09 00:49:02 +0200
commita7c04b3720318834bdbba1e9149e7d373516b0f6 (patch)
tree9c786e2afced4d759b234934338baf8960e1b8cb /server/common
parent3c764b427bda59db3a2f27e3f227d6aebe052ec2 (diff)
git: Allow usernames and emails with newlines in them
Not going to happen but why not use NUL delimiter when it's available.
Diffstat (limited to 'server/common')
-rw-r--r--server/common/src/git.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/server/common/src/git.rs b/server/common/src/git.rs
index 6678db7..c6a44e3 100644
--- a/server/common/src/git.rs
+++ b/server/common/src/git.rs
@@ -69,7 +69,7 @@ fn io_err(action: &str, e: std::io::Error) -> Error {
}
fn parse_user(output: String) -> User {
- let mut lines = output.lines();
+ let mut lines = output.split_terminator('\0');
let name = lines.next().unwrap_or("").to_string();
let username = lines.next().unwrap_or("").to_string();
let email = lines.next().unwrap_or("").to_string();
@@ -325,13 +325,13 @@ impl RepoData {
}
async fn get_author(&self, repo: &Repository, commit: &str) -> Result<User, Error> {
- self.get_log_format(repo, commit, "%an%n%al%n%ae")
+ self.get_log_format(repo, commit, "%an%x00%al%x00%ae")
.map_ok(parse_user)
.await
}
async fn get_commiter(&self, repo: &Repository, commit: &str) -> Result<User, Error> {
- self.get_log_format(repo, commit, "%cn%n%cl%n%ce")
+ self.get_log_format(repo, commit, "%cn%x00%cl%x00%ce")
.map_ok(parse_user)
.await
}