httpie / desktop

🚀 HTTPie Desktop — cross-platform API testing client for humans. Painlessly test REST, GraphQL, and HTTP APIs.
https://httpie.io
Other
2.85k stars 32 forks source link

[Bug]: Important: HTTPIE deletes files of other programs during uninstall if installed incorrectly #162

Open Alfamari opened 6 months ago

Alfamari commented 6 months ago

What happened?

During uninstallation HTTPIE will delete ALL items in it's installation directory rather than filtering out/specifying it's own assets. Which means if the user incorrectly installs the program to a target folder with other contents in it, uninstalling HTTPIE will wipe everything in that folder.

https://github.com/httpie/desktop/assets/132071593/a55788b4-a307-406a-a1c3-f4f8c4f45572

Steps to reproduce?

1. Download HTTPIE with winget: winget download httpie
2. Install winget with /D flag to specify directory: HTTPie_2024.1.2_User_X64_nullsoft_en-US.exe /D='D:\Program Files (x86)\' (do not specify sub-directory)
3. Uninstall HTTPIE with the executable: Uninstall HTTPIE.exe

4. Watch in horror and confusion as unrelated files quickly get deleted.
5. Scramble to cancel the process externally as the built-in cancel/close buttons are locked.
6. Execute file recovery steps.

What did you expect to happen?

I expected HTTPIE to auto-generate it's own subfolder despite specifying /D flag during installation process. (This isn't something HTTPIE needs to change I just got confused because different programs handle things differently. And it explains how I got myself into this mess.)

The real issue is when I went to uninstall HTTPIE I expected it to only specify its OWN assets for deletion rather than assuming it will always be in an isolated folder at all times therefore assuming its safe to delete everything. I also expected the cancel/close buttons to either cancel or terminate the process. I did not expect the cancel/close buttons to be locked denying user intervention.

Platform

Windows

HTTPie Desktop version

2024.1.2

Relevant log output

No response

Code of Conduct

jkbrzt commented 5 months ago

@Alfamari, thanks for the report, and sorry about the trouble. This unfortunate behavior seems to be the default of electron-builder, which is what we use to generate the uninstaller. We’ll see if we can improve it.

Alfamari commented 5 months ago

@jkbrzt, No worries, fortunately by sheer luck I started the installation process with revo uninstaller which created a restore point RIGHT before. In the process, I learned about file recovery and I was able to get EVERYTHING back. I've also used what I've learned from this experience to recover from other mistakes since then.

So while it was stressful in the moment, I was actually able to come out better because of it without any damage done.

Steps 4-6 were more for humor not anger, though looking back at it now it, seems like I missed.