MCPcopy Create free account
hub / github.com/SeleniumHQ/selenium / sanitize_browser_version

Function sanitize_browser_version

rust/src/stats.rs:100–117  ·  view source on GitHub ↗
(browser_version: &str)

Source from the content-addressed store, hash-verified

98}
99
100fn sanitize_browser_version(browser_version: &str) -> String {
101 let version = browser_version.trim().to_ascii_lowercase();
102 if version.is_empty() {
103 return String::new();
104 }
105 if VALID_VERSION_LABELS.contains(&version.as_str()) {
106 return version;
107 }
108 // Report only the numeric major component, never a full version or free text.
109 // Electron accepts pins with a leading "v" (e.g. v36.2.1)
110 let numeric = version.strip_prefix('v').unwrap_or(&version);
111 let major = numeric.split('.').next().unwrap_or_default();
112 if !major.is_empty() && major.bytes().all(|b| b.is_ascii_digit()) {
113 major.to_string()
114 } else {
115 STATS_OTHER.to_string()
116 }
117}
118
119#[tokio::main]
120pub async fn send_stats_to_plausible(http_client: Client, props: Props, sender: Sender<String>) {

Callers 1

sanitizedMethod · 0.85

Calls 3

is_emptyMethod · 0.80
splitMethod · 0.80
bytesMethod · 0.45

Tested by

no test coverage detected