crates/server: enhance auth middleware and error responses
Signed-off-by: NotAShelf <raf@notashelf.dev> Change-Id: I48a780779d884c4a7730347f920b91216a6a6964
This commit is contained in:
parent
000fb8994f
commit
92153bf9aa
8 changed files with 272 additions and 99 deletions
|
|
@ -170,9 +170,9 @@ async fn sign_narinfo(narinfo: &str, key_file: &std::path::Path) -> String {
|
|||
.output()
|
||||
.await;
|
||||
|
||||
if let Ok(o) = re_output {
|
||||
if let Ok(parsed) = serde_json::from_slice::<serde_json::Value>(&o.stdout) {
|
||||
if let Some(sigs) = parsed
|
||||
if let Ok(o) = re_output
|
||||
&& let Ok(parsed) = serde_json::from_slice::<serde_json::Value>(&o.stdout)
|
||||
&& let Some(sigs) = parsed
|
||||
.as_array()
|
||||
.and_then(|a| a.first())
|
||||
.and_then(|e| e.get("signatures"))
|
||||
|
|
@ -187,8 +187,6 @@ async fn sign_narinfo(narinfo: &str, key_file: &std::path::Path) -> String {
|
|||
return format!("{narinfo}{}\n", sig_lines.join("\n"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
narinfo.to_string()
|
||||
}
|
||||
_ => narinfo.to_string(),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue