From 500ab2f5683a68a376e0954939326cf8aee59ebe Mon Sep 17 00:00:00 2001 From: tw93 Date: Sat, 7 Feb 2026 10:38:17 +0800 Subject: [PATCH] fix(uninstall): detect Zed HTTPStorages channel variants (#422) --- lib/core/app_protection.sh | 8 ++++++++ tests/uninstall_naming_variants.bats | 12 ++++++++++++ 2 files changed, 20 insertions(+) diff --git a/lib/core/app_protection.sh b/lib/core/app_protection.sh index cc54844..63247d4 100755 --- a/lib/core/app_protection.sh +++ b/lib/core/app_protection.sh @@ -997,6 +997,14 @@ find_app_files() { ) fi + # Issue #422: Zed channel builds can leave data under another channel bundle id. + # Example: uninstalling dev.zed.Zed-Nightly should also detect dev.zed.Zed-Preview leftovers. + if [[ "$bundle_id" =~ ^dev\.zed\.Zed- ]] && [[ -d "$HOME/Library/HTTPStorages" ]]; then + while IFS= read -r -d '' zed_http_storage; do + files_to_clean+=("$zed_http_storage") + done < <(command find "$HOME/Library/HTTPStorages" -maxdepth 1 -name "dev.zed.Zed-*" -print0 2> /dev/null) + fi + # Process standard patterns for p in "${user_patterns[@]}"; do local expanded_path="${p/#\~/$HOME}" diff --git a/tests/uninstall_naming_variants.bats b/tests/uninstall_naming_variants.bats index efd687f..1b25560 100644 --- a/tests/uninstall_naming_variants.bats +++ b/tests/uninstall_naming_variants.bats @@ -60,6 +60,18 @@ setup() { [[ "$result" =~ "Library/Application Support/Zed" ]] } +@test "find_app_files detects Zed channel variants in HTTPStorages only" { + mkdir -p "$HOME/Library/HTTPStorages/dev.zed.Zed-Preview" + mkdir -p "$HOME/Library/Application Support/Firefox/Profiles/default/storage/default/https+++zed.dev" + echo "test" > "$HOME/Library/HTTPStorages/dev.zed.Zed-Preview/data" + echo "test" > "$HOME/Library/Application Support/Firefox/Profiles/default/storage/default/https+++zed.dev/data" + + result=$(find_app_files "dev.zed.Zed-Nightly" "Zed Nightly") + + [[ "$result" =~ "Library/HTTPStorages/dev.zed.Zed-Preview" ]] + [[ ! "$result" =~ "storage/default/https\+\+\+zed\.dev" ]] +} + @test "find_app_files detects multiple naming variants simultaneously" { mkdir -p "$HOME/.config/maestro-studio" mkdir -p "$HOME/Library/Application Support/MaestroStudio"