Format
This commit is contained in:
parent
48c0e6fd32
commit
cd0f9d9733
1 changed files with 6 additions and 2 deletions
|
|
@ -57,7 +57,9 @@ fn is_safe_ipfs_path(stripped: &str) -> bool {
|
|||
|| stripped.contains(':')
|
||||
|| stripped.contains('\\')
|
||||
|| stripped.starts_with('/')
|
||||
|| stripped.chars().any(|c| c.is_whitespace() || c.is_control()))
|
||||
|| stripped
|
||||
.chars()
|
||||
.any(|c| c.is_whitespace() || c.is_control()))
|
||||
}
|
||||
|
||||
/// Resolve an on-chain BCMR URI into one or more candidate URLs to try in order.
|
||||
|
|
@ -441,7 +443,9 @@ mod tests {
|
|||
|
||||
#[test]
|
||||
fn ipfs_uri_with_unsafe_path_yields_no_candidates() {
|
||||
assert!(resolve_uri_candidates("ipfs://../admin", "http://127.0.0.1:3002/ipfs/").is_empty());
|
||||
assert!(
|
||||
resolve_uri_candidates("ipfs://../admin", "http://127.0.0.1:3002/ipfs/").is_empty()
|
||||
);
|
||||
assert!(resolve_uri_candidates("ipfs://x@evil.com", "").is_empty());
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue