Skip to content
This repository was archived by the owner on Jul 5, 2024. It is now read-only.

Commit 1065b67

Browse files
committed
fix(credential): only truncate trailing newline
1 parent bf82873 commit 1065b67

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/main.rs

+6-1
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,12 @@ fn get_token() -> Result<String, anyhow::Error> {
105105
tracing::debug!("using systemd credentials");
106106
path.push("/token");
107107
return std::fs::read_to_string(path)
108-
.map(|token| token.replace('\n', ""))
108+
.map(|mut token| {
109+
if token.ends_with('\n') {
110+
token.truncate(token.len() - 1)
111+
}
112+
token
113+
})
109114
.context("unable to retrieve bot token from the \"token\" systemd credential");
110115
}
111116

0 commit comments

Comments
 (0)