diff options
| author | 2026-01-14 07:43:18 +0000 | |
|---|---|---|
| committer | 2026-01-14 07:43:18 +0000 | |
| commit | f8bf90421acce2c05ffedcee8e9b07f9adb96295 (patch) | |
| tree | 61a3021ec25f4ef292dff7ba4c4bacc0613706a4 /src-tauri/src | |
| parent | 2a281e51b63c44312f5a1039d28bc04eccba2502 (diff) | |
| download | DropOut-f8bf90421acce2c05ffedcee8e9b07f9adb96295.tar.gz DropOut-f8bf90421acce2c05ffedcee8e9b07f9adb96295.zip | |
Improve placeholder check to verify both opening and closing delimiters
Co-authored-by: HsiangNianian <44714368+HsiangNianian@users.noreply.github.com>
Diffstat (limited to 'src-tauri/src')
| -rw-r--r-- | src-tauri/src/main.rs | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rs index c2fd098..3a5f8a5 100644 --- a/src-tauri/src/main.rs +++ b/src-tauri/src/main.rs @@ -40,6 +40,20 @@ impl MsRefreshTokenState { } } +/// Check if a string contains unresolved placeholders in the form ${...} +fn has_unresolved_placeholder(s: &str) -> bool { + if let Some(start_pos) = s.find("${") { + // Check if there's a closing brace after the opening + if let Some(end_pos) = s[start_pos..].find('}') { + // Verify the closing brace is after the opening sequence + return end_pos > 2; // "${" is 2 chars, so } must be after position 2 + } + // Found opening but no closing brace - treat as unresolved + return true; + } + false +} + #[tauri::command] async fn start_game( window: Window, @@ -450,7 +464,7 @@ async fn start_game( arg = arg.replace(key, replacement); } // Skip arguments with unresolved placeholders - if !arg.contains("${") { + if !has_unresolved_placeholder(&arg) { args.push(arg); } } else if let Some(arr) = val.as_array() { @@ -461,7 +475,7 @@ async fn start_game( arg = arg.replace(key, replacement); } // Skip arguments with unresolved placeholders - if !arg.contains("${") { + if !has_unresolved_placeholder(&arg) { args.push(arg); } } |