diff --git a/exts/devmaster/src/lib/utils/mod.rs b/exts/devmaster/src/lib/utils/mod.rs index 987cdfb6b53165f0d99fff1be011dea17de2da58..cfd18b5d7d49376444a9e0219f9297f6df565e9f 100644 --- a/exts/devmaster/src/lib/utils/mod.rs +++ b/exts/devmaster/src/lib/utils/mod.rs @@ -176,6 +176,8 @@ pub(crate) fn replace_ifname(s: &str) -> String { /// It uses a regular expression to match one or more whitespace characters. /// The input string is not modified, and a new string with the replacements is returned. pub(crate) fn replace_whitespace(s: &str) -> String { + // Remove consecutive spaces after the last non-space character + let s = s.trim_end_matches(' '); // Create a regular expression to match one or more whitespace characters. let re = Regex::new(r"\s+").unwrap(); // Use the regular expression to replace all matches with underscores.