first pass of merging in warp (doesn't build)

This commit is contained in:
Ryan Ward
2026-07-01 16:08:58 -05:00
parent 2f64909469
commit 4770ac06b5
3662 changed files with 414574 additions and 89772 deletions
+28
View File
@@ -0,0 +1,28 @@
pub fn escape_html_attribute(value: &str) -> String {
let mut escaped = String::with_capacity(value.len());
for ch in value.chars() {
match ch {
'&' => escaped.push_str("&"),
'"' => escaped.push_str("""),
'\'' => escaped.push_str("'"),
'<' => escaped.push_str("&lt;"),
'>' => escaped.push_str("&gt;"),
_ => escaped.push(ch),
}
}
escaped
}
#[cfg(any(target_family = "wasm", test))]
pub(crate) fn safe_browser_open_url(url: &str) -> Option<String> {
let parsed_url = url::Url::parse(url).ok()?;
match parsed_url.scheme() {
"http" | "https" | "mailto" | "warp" | "warppreview" | "warpdev" | "warplocal"
| "warposs" | "warpintegration" => Some(parsed_url.to_string()),
_ => None,
}
}
#[cfg(test)]
#[path = "browser_tests.rs"]
mod tests;