From bdb590834eab7256f1603002838f705039b07176 Mon Sep 17 00:00:00 2001 From: Guido Falsi Date: Wed, 19 Apr 2023 11:46:08 +0200 Subject: [PATCH] Skip anything after an # symbol in the filename. Windows renames files adding (1), (2) etc. before the .exe in case of duplicates, which causes the host or key values to be garbled. This allows to protect from this adding a final "#" symbol to the filename. --- src/license.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/license.rs b/src/license.rs index 8875d2b64..7d4270052 100644 --- a/src/license.rs +++ b/src/license.rs @@ -37,6 +37,11 @@ pub fn get_license_from_string(s: &str) -> ResultType { s }; if s.contains("host=") { + let s = if s.contains("#") { + &s[0..s.find("#").unwrap_or(s.len())] + } else { + s + }; let strs: Vec<&str> = s.split("host=").collect(); if strs.len() == 2 { let strs2: Vec<&str> = strs[1].split(",key=").collect();