Skip to content

Fixed Cryptomator not being completely removed during uninstall - #4228

Merged
infeo merged 5 commits into
cryptomator:developfrom
jose-cardoso-a22506616:issue-3993
May 4, 2026
Merged

infeo merged 5 commits into
cryptomator:developfrom
jose-cardoso-a22506616:issue-3993

Conversation

@jose-cardoso-a22506616

Copy link
Copy Markdown
Contributor

This PR fixes the issue #3993, where the Cryptomator alias remained in the Windows hosts file after uninstallation.

I added to main.wxs a CustomAction called PatchWebDAVUninstall which executes before the files get removed during uninstallation.
I updated patchWebDAV.bat so it can receive a second argument that specifies if an action is "install" or "uninstall". I also defined a default value as "install" in case there are no arguments.
Finally, I updated the patchWebDAV.ps1. I added a parameter, $Action, to be possible to have an uninstall action. I also added a function called Remove-AliasFromHost. It works by saving the content of the hosts file to a temporary file without the alias and then it replaces the original file with the temporary one. I decided to use a temporary file for this because I ran into a lot of issues when writing directly into the original file. Most of time, it would erase all the information in the file. I did some research, and apparently if you do it that way the process can get interrupted which can cause that. Using a temporary file avoids this risk, since you're just replacing the original file.

Fixes #3993

…he lines responsible for uploading the .asc file, so that I can build the project using GitHub workflows without any errors
…as from host and an if statement that checks when to execute the Remove-AliasFromHost function.

I added to patchWebDAV.bat a second argument so it can be defined if it's supposed to install or uninstall.

I added to main.wxs a new instruction PatchWebDAVUninstall. This way I can pass the "uninstall" instruction to the patchWebDAV.bat. In InstallExecuteSequence I made so that the PatchWebDAVUninstall only gets executed before the files get removed so that the patchWebDAV.bat doesn't get deleted before deleting the hosts entry.
@CLAassistant

CLAassistant commented Apr 25, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

Comment thread dist/win/contrib/patchWebDAV.ps1 Resolved
Comment thread dist/win/contrib/patchWebDAV.ps1 Resolved
Comment thread dist/win/contrib/patchWebDAV.ps1 Resolved
I updated Add-AliasToHost with the write-and-move pattern using a temporary file just like in the Remove-AliasFromHost function.
The install block now only gets executed if the parameter is actually "install".
Comment thread dist/win/contrib/patchWebDAV.ps1 Resolved
@infeo

infeo commented May 4, 2026

Copy link
Copy Markdown
Member

@jose-cardoso-a22506616 Your commits are signed. For future contributions, please sign the commits, otherwise the PR will be closed.

This time, i'll squash the changes such that the commits are signed with my sig/github.

@infeo infeo added this to the next milestone May 4, 2026
@infeo
infeo merged commit 472b10a into cryptomator:develop May 4, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cryptomator is not completely removed during uninstall

4 participants