fix: PO parser escape order, proxy endpoint consistency, and accessibility bugs

This commit is contained in:
NetworkCats
2026-03-22 17:52:25 +08:00
parent ab7fb7c3c6
commit 5af03bf9b9
5 changed files with 18 additions and 8 deletions
+2 -2
View File
@@ -81,8 +81,8 @@ fn proxy_field_handler(
return Err(AppError::DbNotReady);
}
let ip = resolve_ip(headers, query, state.dev_mode)?;
let proxy = db::lookup_proxy(&state.db, ip).ok_or(AppError::DbLookupFailed)?;
Ok(format!("{}\n", field(&proxy)))
let value = db::lookup_proxy(&state.db, ip).map_or(false, |p| field(&p));
Ok(format!("{value}\n"))
}
pub async fn asn_handler(
+2 -1
View File
@@ -212,9 +212,10 @@ fn append_quoted(target: &mut String, quoted: &str) {
if s.len() >= 2 && s.starts_with('"') && s.ends_with('"') {
let inner = &s[1..s.len() - 1];
let unescaped = inner
.replace("\\\\", "\x00")
.replace("\\n", "\n")
.replace("\\\"", "\"")
.replace("\\\\", "\\");
.replace('\x00', "\\");
target.push_str(&unescaped);
}
}