mirror of
https://github.com/zhom/donutbrowser.git
synced 2026-07-31 00:17:28 +02:00
refactor: normalize invalid locale string
This commit is contained in:
@@ -567,7 +567,15 @@ impl WayfernManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Denormalize fingerprint for Wayfern CDP (convert arrays/objects to JSON strings)
|
// Denormalize fingerprint for Wayfern CDP (convert arrays/objects to JSON strings)
|
||||||
let fingerprint_for_cdp = Self::denormalize_fingerprint(fingerprint);
|
let mut fingerprint_for_cdp = Self::denormalize_fingerprint(fingerprint);
|
||||||
|
|
||||||
|
// Normalize languages: if it's a comma-separated string, convert to array
|
||||||
|
if let Some(obj) = fingerprint_for_cdp.as_object_mut() {
|
||||||
|
if let Some(serde_json::Value::String(s)) = obj.get("languages").cloned() {
|
||||||
|
let arr: Vec<&str> = s.split(',').map(|l| l.trim()).collect();
|
||||||
|
obj.insert("languages".to_string(), json!(arr));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
log::info!(
|
log::info!(
|
||||||
"Fingerprint prepared for CDP command, fields: {:?}",
|
"Fingerprint prepared for CDP command, fields: {:?}",
|
||||||
|
|||||||
Reference in New Issue
Block a user