From 3ff4c734bf4929bd0c29e629ba215f7151b2b159 Mon Sep 17 00:00:00 2001 From: Yueer <36443462+YueerMoe@users.noreply.github.com> Date: Mon, 9 Feb 2026 01:33:13 +0800 Subject: [PATCH 1/7] =?UTF-8?q?fix(update):=20=E4=BF=AE=E5=A4=8D=E6=9B=B4?= =?UTF-8?q?=E6=96=B0=E8=84=9A=E6=9C=AC=E7=9A=84=E8=B7=AF=E5=BE=84=E5=BC=95?= =?UTF-8?q?=E5=8F=B7=E8=BD=AC=E4=B9=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src-tauri/src/services/update.rs | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/src-tauri/src/services/update.rs b/src-tauri/src/services/update.rs index 193146b..3c4c026 100644 --- a/src-tauri/src/services/update.rs +++ b/src-tauri/src/services/update.rs @@ -24,7 +24,11 @@ pub fn prepare_paths(exe_name: &std::ffi::OsStr) -> Result let new_exe = temp_dir.join(exe_name); let batch_path = temp_dir.join("updater.bat"); - Ok(UpdatePaths { temp_dir, new_exe, batch_path }) + Ok(UpdatePaths { + temp_dir, + new_exe, + batch_path, + }) } pub async fn download_new_exe( @@ -101,7 +105,7 @@ echo 启动新版本... start "" /min "{current_exe}" echo 清理临时文件... -start "" /min cmd /c "timeout /t 3 /nobreak >nul & if exist \"{temp_dir}\" rd /s /q \"{temp_dir}\"" +start "" /min cmd /c "timeout /t 3 /nobreak >nul & if exist ""{temp_dir}"" rd /s /q ""{temp_dir}""" exit /b 0 "#, @@ -113,3 +117,24 @@ exit /b 0 batch_content.replace('\n', "\r\n") } + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn build_updater_batch_uses_cmd_double_quotes_for_cleanup() { + let content = build_updater_batch( + "endfield-cat.exe", + Path::new("C:\\Temp\\endfield-cat-update\\new.exe"), + Path::new("C:\\Program Files\\EndCat\\endfield-cat.exe"), + Path::new("C:\\Temp\\endfield-cat-update"), + ); + + // In cmd.exe, `\"` is not an escape; it can break parsing and lead to paths like `\\`. + assert!(!content.contains("\\\"")); + assert!(content.contains( + r#"if exist ""C:\Temp\endfield-cat-update"" rd /s /q ""C:\Temp\endfield-cat-update""""# + )); + } +} From 10f6a546039db46badbb0b668d8a06a0be44ea14 Mon Sep 17 00:00:00 2001 From: Yueer <36443462+YueerMoe@users.noreply.github.com> Date: Mon, 9 Feb 2026 01:58:35 +0800 Subject: [PATCH 2/7] =?UTF-8?q?Revert=20"fix(update):=20=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E6=9B=B4=E6=96=B0=E8=84=9A=E6=9C=AC=E7=9A=84=E8=B7=AF=E5=BE=84?= =?UTF-8?q?=E5=BC=95=E5=8F=B7=E8=BD=AC=E4=B9=89"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 3ff4c734bf4929bd0c29e629ba215f7151b2b159. --- src-tauri/src/services/update.rs | 29 ++--------------------------- 1 file changed, 2 insertions(+), 27 deletions(-) diff --git a/src-tauri/src/services/update.rs b/src-tauri/src/services/update.rs index 3c4c026..193146b 100644 --- a/src-tauri/src/services/update.rs +++ b/src-tauri/src/services/update.rs @@ -24,11 +24,7 @@ pub fn prepare_paths(exe_name: &std::ffi::OsStr) -> Result let new_exe = temp_dir.join(exe_name); let batch_path = temp_dir.join("updater.bat"); - Ok(UpdatePaths { - temp_dir, - new_exe, - batch_path, - }) + Ok(UpdatePaths { temp_dir, new_exe, batch_path }) } pub async fn download_new_exe( @@ -105,7 +101,7 @@ echo 启动新版本... start "" /min "{current_exe}" echo 清理临时文件... -start "" /min cmd /c "timeout /t 3 /nobreak >nul & if exist ""{temp_dir}"" rd /s /q ""{temp_dir}""" +start "" /min cmd /c "timeout /t 3 /nobreak >nul & if exist \"{temp_dir}\" rd /s /q \"{temp_dir}\"" exit /b 0 "#, @@ -117,24 +113,3 @@ exit /b 0 batch_content.replace('\n', "\r\n") } - -#[cfg(test)] -mod tests { - use super::*; - - #[test] - fn build_updater_batch_uses_cmd_double_quotes_for_cleanup() { - let content = build_updater_batch( - "endfield-cat.exe", - Path::new("C:\\Temp\\endfield-cat-update\\new.exe"), - Path::new("C:\\Program Files\\EndCat\\endfield-cat.exe"), - Path::new("C:\\Temp\\endfield-cat-update"), - ); - - // In cmd.exe, `\"` is not an escape; it can break parsing and lead to paths like `\\`. - assert!(!content.contains("\\\"")); - assert!(content.contains( - r#"if exist ""C:\Temp\endfield-cat-update"" rd /s /q ""C:\Temp\endfield-cat-update""""# - )); - } -} From f35697f9ea8a0381191dba4f579ab64e88bf4fa2 Mon Sep 17 00:00:00 2001 From: Yueer <36443462+YueerMoe@users.noreply.github.com> Date: Mon, 9 Feb 2026 01:33:13 +0800 Subject: [PATCH 3/7] =?UTF-8?q?fix(update):=20=E4=BF=AE=E5=A4=8D=E6=9B=B4?= =?UTF-8?q?=E6=96=B0=E8=84=9A=E6=9C=AC=E7=9A=84=E8=B7=AF=E5=BE=84=E5=BC=95?= =?UTF-8?q?=E5=8F=B7=E8=BD=AC=E4=B9=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src-tauri/src/services/update.rs | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/src-tauri/src/services/update.rs b/src-tauri/src/services/update.rs index 193146b..3c4c026 100644 --- a/src-tauri/src/services/update.rs +++ b/src-tauri/src/services/update.rs @@ -24,7 +24,11 @@ pub fn prepare_paths(exe_name: &std::ffi::OsStr) -> Result let new_exe = temp_dir.join(exe_name); let batch_path = temp_dir.join("updater.bat"); - Ok(UpdatePaths { temp_dir, new_exe, batch_path }) + Ok(UpdatePaths { + temp_dir, + new_exe, + batch_path, + }) } pub async fn download_new_exe( @@ -101,7 +105,7 @@ echo 启动新版本... start "" /min "{current_exe}" echo 清理临时文件... -start "" /min cmd /c "timeout /t 3 /nobreak >nul & if exist \"{temp_dir}\" rd /s /q \"{temp_dir}\"" +start "" /min cmd /c "timeout /t 3 /nobreak >nul & if exist ""{temp_dir}"" rd /s /q ""{temp_dir}""" exit /b 0 "#, @@ -113,3 +117,24 @@ exit /b 0 batch_content.replace('\n', "\r\n") } + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn build_updater_batch_uses_cmd_double_quotes_for_cleanup() { + let content = build_updater_batch( + "endfield-cat.exe", + Path::new("C:\\Temp\\endfield-cat-update\\new.exe"), + Path::new("C:\\Program Files\\EndCat\\endfield-cat.exe"), + Path::new("C:\\Temp\\endfield-cat-update"), + ); + + // In cmd.exe, `\"` is not an escape; it can break parsing and lead to paths like `\\`. + assert!(!content.contains("\\\"")); + assert!(content.contains( + r#"if exist ""C:\Temp\endfield-cat-update"" rd /s /q ""C:\Temp\endfield-cat-update""""# + )); + } +} From 365d198deee319287a670777d0b804106a8e2876 Mon Sep 17 00:00:00 2001 From: Yueer <36443462+YueerMoe@users.noreply.github.com> Date: Mon, 9 Feb 2026 02:10:03 +0800 Subject: [PATCH 4/7] =?UTF-8?q?fix(update):=20=E4=BD=BF=E7=94=A8=20PowerSh?= =?UTF-8?q?ell=20=E6=B8=85=E7=90=86=E6=9B=B4=E6=96=B0=E4=B8=B4=E6=97=B6?= =?UTF-8?q?=E7=9B=AE=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src-tauri/src/services/update.rs | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/src-tauri/src/services/update.rs b/src-tauri/src/services/update.rs index 3c4c026..509596b 100644 --- a/src-tauri/src/services/update.rs +++ b/src-tauri/src/services/update.rs @@ -105,7 +105,7 @@ echo 启动新版本... start "" /min "{current_exe}" echo 清理临时文件... -start "" /min cmd /c "timeout /t 3 /nobreak >nul & if exist ""{temp_dir}"" rd /s /q ""{temp_dir}""" +start "" /min powershell -NoProfile -ExecutionPolicy Bypass -Command "param([string]$p) Start-Sleep -Seconds 3; if (Test-Path -LiteralPath $p) {{ Remove-Item -LiteralPath $p -Recurse -Force }}" "{temp_dir}" exit /b 0 "#, @@ -123,7 +123,7 @@ mod tests { use super::*; #[test] - fn build_updater_batch_uses_cmd_double_quotes_for_cleanup() { + fn build_updater_batch_uses_powershell_literalpath_cleanup() { let content = build_updater_batch( "endfield-cat.exe", Path::new("C:\\Temp\\endfield-cat-update\\new.exe"), @@ -133,8 +133,19 @@ mod tests { // In cmd.exe, `\"` is not an escape; it can break parsing and lead to paths like `\\`. assert!(!content.contains("\\\"")); - assert!(content.contains( - r#"if exist ""C:\Temp\endfield-cat-update"" rd /s /q ""C:\Temp\endfield-cat-update""""# - )); + assert!(content.contains(r#"powershell -NoProfile -ExecutionPolicy Bypass -Command "param([string]$p) Start-Sleep -Seconds 3; if (Test-Path -LiteralPath $p) { Remove-Item -LiteralPath $p -Recurse -Force }""#)); + assert!(content.contains(r#""C:\Temp\endfield-cat-update""#)); + } + + #[test] + fn build_updater_batch_cleanup_quotes_ampersand_path() { + let content = build_updater_batch( + "endfield-cat.exe", + Path::new("C:\\Temp\\endfield-cat-update\\new.exe"), + Path::new("C:\\Program Files\\EndCat\\endfield-cat.exe"), + Path::new("C:\\Temp\\A&B\\endfield-cat-update"), + ); + + assert!(content.contains(r#""C:\Temp\A&B\endfield-cat-update""#)); } } From fcdbac753b266ad58ae670a123243bdbac300325 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Sun, 8 Feb 2026 18:26:17 +0000 Subject: [PATCH 5/7] =?UTF-8?q?chore(version):=20=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E7=89=88=E6=9C=AC=E5=8F=B7=E4=B8=BA=200.2.0-pre.6988d549.793cd?= =?UTF-8?q?77?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 2 +- src-tauri/Cargo.toml | 2 +- src-tauri/tauri.conf.json | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index c9da6b8..5b04b07 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "endfield-cat", "private": true, - "version": "0.2.0-pre.6988755b.087703a", + "version": "0.2.0-pre.6988d549.793cd77", "type": "module", "engines": { "node": ">=24 <25" diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml index ea02799..a0af3b1 100644 --- a/src-tauri/Cargo.toml +++ b/src-tauri/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "endfield-cat" -version = "0.2.0-pre.6988755b.087703a" +version = "0.2.0-pre.6988d549.793cd77" description = "A Tauri App" authors = ["you"] edition = "2021" diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index 7f01e01..49ce76e 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -1,7 +1,7 @@ { "$schema": "https://schema.tauri.app/config/2", "productName": "endfield-cat", - "version": "0.2.0-pre.6988755b.087703a", + "version": "0.2.0-pre.6988d549.793cd77", "identifier": "org.boxcat.endfield-cat", "build": { "beforeDevCommand": "yarn dev", From 6fc7ac08526f662ff1833f6a1794af2c3412e829 Mon Sep 17 00:00:00 2001 From: Yueer <36443462+YueerMoe@users.noreply.github.com> Date: Mon, 9 Feb 2026 02:45:41 +0800 Subject: [PATCH 6/7] =?UTF-8?q?chore(version):=20=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E7=89=88=E6=9C=AC=E5=8F=B7=E4=B8=BA=200.2.1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 2 +- src-tauri/Cargo.lock | 2 +- src-tauri/Cargo.toml | 2 +- src-tauri/tauri.conf.json | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index 3abf19c..9027674 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "endfield-cat", "private": true, - "version": "0.2.0", + "version": "0.2.1", "type": "module", "engines": { "node": ">=24 <25" diff --git a/src-tauri/Cargo.lock b/src-tauri/Cargo.lock index 41b2e54..6772e63 100644 --- a/src-tauri/Cargo.lock +++ b/src-tauri/Cargo.lock @@ -878,7 +878,7 @@ checksum = "4ef6b89e5b37196644d8796de5268852ff179b44e96276cf4290264843743bb7" [[package]] name = "endfield-cat" -version = "0.2.0" +version = "0.2.1" dependencies = [ "futures-util", "reqwest", diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml index 26495d6..edd5712 100644 --- a/src-tauri/Cargo.toml +++ b/src-tauri/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "endfield-cat" -version = "0.2.0" +version = "0.2.1" description = "A Tauri App" authors = ["you"] edition = "2021" diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index 330a549..a69e5e3 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -1,7 +1,7 @@ { "$schema": "https://schema.tauri.app/config/2", "productName": "endfield-cat", - "version": "0.2.0", + "version": "0.2.1", "identifier": "org.boxcat.endfield-cat", "build": { "beforeDevCommand": "yarn dev", From 003f6bdddcabd20a8550a0993f05dc8ae7cf0a57 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Sun, 8 Feb 2026 19:04:20 +0000 Subject: [PATCH 7/7] =?UTF-8?q?chore(version):=20=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E7=89=88=E6=9C=AC=E5=8F=B7=E4=B8=BA=200.2.1-pre.6988de34.ac631?= =?UTF-8?q?d6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 2 +- src-tauri/Cargo.toml | 2 +- src-tauri/tauri.conf.json | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 9027674..d41b12d 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "endfield-cat", "private": true, - "version": "0.2.1", + "version": "0.2.1-pre.6988de34.ac631d6", "type": "module", "engines": { "node": ">=24 <25" diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml index edd5712..fbd39aa 100644 --- a/src-tauri/Cargo.toml +++ b/src-tauri/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "endfield-cat" -version = "0.2.1" +version = "0.2.1-pre.6988de34.ac631d6" description = "A Tauri App" authors = ["you"] edition = "2021" diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index a69e5e3..cccee58 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -1,7 +1,7 @@ { "$schema": "https://schema.tauri.app/config/2", "productName": "endfield-cat", - "version": "0.2.1", + "version": "0.2.1-pre.6988de34.ac631d6", "identifier": "org.boxcat.endfield-cat", "build": { "beforeDevCommand": "yarn dev",