Skip to content

Commit f4d9320

Browse files
committed
fix(vfox): trim lua github token
1 parent f4845ba commit f4d9320

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

crates/vfox/src/lua_mod/http.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,11 @@ fn into_headers(table: &Table) -> Result<HeaderMap> {
6363
}
6464

6565
fn github_token(lua: &Lua) -> Option<String> {
66-
if let Ok(token) = lua.named_registry_value::<String>("github_token")
67-
&& !token.trim().is_empty()
68-
{
69-
return Some(token);
66+
if let Ok(token) = lua.named_registry_value::<String>("github_token") {
67+
let token = token.trim();
68+
if !token.is_empty() {
69+
return Some(token.to_string());
70+
}
7071
}
7172

7273
["MISE_GITHUB_TOKEN", "GITHUB_API_TOKEN", "GITHUB_TOKEN"]
@@ -389,7 +390,7 @@ mod tests {
389390
#[test]
390391
fn test_add_default_headers_uses_registry_token() {
391392
let lua = Lua::new();
392-
lua.set_named_registry_value("github_token", "ghp_registry")
393+
lua.set_named_registry_value("github_token", " ghp_registry\n")
393394
.unwrap();
394395

395396
let headers = add_default_headers(

0 commit comments

Comments
 (0)