mirror of
https://github.com/Yuyi-Oak/BlueArchiveToolkit.git
synced 2026-09-18 06:34:54 +08:00
fix: 保持官方资源 adapter URL 错误契约
This commit is contained in:
@@ -133,7 +133,12 @@ fn sanitize_component(component: &str, url: &str) -> Result<String, String> {
|
||||
if component == "." || component == ".." || component.is_empty() {
|
||||
return Err(format!("官方 URL 包含不安全路径片段:{url}"));
|
||||
}
|
||||
if component.contains('?') || component.contains('#') || component.contains('\\') {
|
||||
if component.contains('?') || component.contains('#') {
|
||||
return Err(format!(
|
||||
"官方资源 URL 包含 query 或 fragment 等不安全路径字符:{url}"
|
||||
));
|
||||
}
|
||||
if component.contains('\\') {
|
||||
return Err(format!("官方资源 URL 包含不安全路径字符:{url}"));
|
||||
}
|
||||
Ok(component.to_string())
|
||||
|
||||
Reference in New Issue
Block a user