From 5a9d9df4aeb31446db878f98c6ed5fcc5f2bc77d Mon Sep 17 00:00:00 2001 From: DuProcess <273172371+DuProcess@users.noreply.github.com> Date: Thu, 16 Jul 2026 22:43:03 -0400 Subject: [PATCH] Quote Windows release packaging paths --- scripts/package-release.sh | 6 +++++- tests/release_scripts.rs | 4 ++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/scripts/package-release.sh b/scripts/package-release.sh index e26d944..921305b 100755 --- a/scripts/package-release.sh +++ b/scripts/package-release.sh @@ -148,10 +148,14 @@ strip_bin() { esac } +powershell_word() { + printf "'%s'" "$(printf '%s' "$1" | sed "s/'/''/g")" +} + powershell_compress_archive() { for ps in powershell.exe powershell pwsh.exe pwsh; do if command -v "$ps" >/dev/null 2>&1; then - "$ps" -NoProfile -Command "Compress-Archive -Force -Path '$stage' -DestinationPath '$out_dir/$artifact'" + "$ps" -NoProfile -Command "Compress-Archive -Force -LiteralPath $(powershell_word "$stage") -DestinationPath $(powershell_word "$out_dir/$artifact")" return 0 fi done diff --git a/tests/release_scripts.rs b/tests/release_scripts.rs index 619f38a..ef3a6ba 100644 --- a/tests/release_scripts.rs +++ b/tests/release_scripts.rs @@ -559,8 +559,12 @@ fn package_release_maps_windows_cross_arch_targets() { fn package_release_windows_zip_tries_classic_and_core_powershell() { let package = include_str!("../scripts/package-release.sh"); assert!(package.contains("powershell_compress_archive()")); + assert!(package.contains("powershell_word()")); + assert!(package.contains("sed \"s/'/''/g\"")); assert!(package.contains("for ps in powershell.exe powershell pwsh.exe pwsh; do")); assert!(package.contains("\"$ps\" -NoProfile -Command")); + assert!(package.contains("Compress-Archive -Force -LiteralPath $(powershell_word \"$stage\")")); + assert!(package.contains("-DestinationPath $(powershell_word \"$out_dir/$artifact\")")); assert!(package.contains("windows packaging requires PowerShell or zip")); }