fix(audit): Batch 2 生产代码 unwrap 替换 (20 处)
Some checks failed
CI / Lint & TypeCheck (push) Has been cancelled
CI / Unit Tests (push) Has been cancelled
CI / Build Frontend (push) Has been cancelled
CI / Rust Check (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
CI / E2E Tests (push) Has been cancelled

P0 修复:
- viking_commands.rs: URI 路径构建 unwrap → ok_or_else 错误传播
- clip.rs: 临时文件路径 unwrap → ok_or_else (防 Windows 中文路径 panic)

P1 修复:
- personality_detector.rs: Mutex lock unwrap → unwrap_or_else 防中毒传播
- pptx.rs: HashMap.get unwrap → expect (来自 keys() 迭代)

P2 修复:
- 4 处 SystemTime.unwrap → expect("system clock is valid")
- 4 处 dev_server URL.parse.unwrap → expect("hardcoded URL is valid")
- 9 处 nl_schedule Regex.unwrap → expect("static regex is valid")
- 5 处 data_masking Regex.unwrap → expect("static regex is valid")
- 2 处 pipeline/state Regex.unwrap → expect("static regex is valid")

全量测试通过: 719 passed, 0 failed
This commit is contained in:
iven
2026-04-19 08:38:09 +08:00
parent 924ad5a6ec
commit 4329bae1ea
12 changed files with 29 additions and 29 deletions

View File

@@ -48,7 +48,7 @@ impl ExecutionContext {
steps_output: HashMap::new(),
variables: HashMap::new(),
loop_context: None,
expr_regex: Regex::new(r"\$\{([^}]+)\}").unwrap(),
expr_regex: Regex::new(r"\$\{([^}]+)\}").expect("static regex is valid"),
}
}
@@ -73,7 +73,7 @@ impl ExecutionContext {
steps_output,
variables,
loop_context: None,
expr_regex: Regex::new(r"\$\{([^}]+)\}").unwrap(),
expr_regex: Regex::new(r"\$\{([^}]+)\}").expect("static regex is valid"),
}
}