Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show a dedicated message when mounting to an occupied Windows drive #2961

Merged
merged 2 commits into from
Jun 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package org.cryptomator.common.mount;

public class MountPointInUseException extends IllegalMountPointException {

public MountPointInUseException(String msg) {
super(msg);
}
}
6 changes: 5 additions & 1 deletion src/main/java/org/cryptomator/common/mount/Mounter.java
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,11 @@ private Runnable prepareMountPoint() throws IOException {
}
} else {
var mpIsDriveLetter = userChosenMountPoint.toString().matches("[A-Z]:\\\\");
if (!mpIsDriveLetter && canMountToParent && !canMountToDir) {
if (mpIsDriveLetter) {
if (driveLetters.getOccupied().contains(userChosenMountPoint)) {
throw new MountPointInUseException(userChosenMountPoint.toString());
}
} else if (canMountToParent && !canMountToDir) {
MountWithinParentUtil.prepareParentNoMountPoint(userChosenMountPoint);
cleanup = () -> {
MountWithinParentUtil.cleanup(userChosenMountPoint);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.cryptomator.ui.unlock;

import org.cryptomator.common.mount.MountPointInUseException;
import org.cryptomator.common.mount.MountPointNotExistsException;
import org.cryptomator.common.mount.MountPointNotSupportedException;
import org.cryptomator.common.vaults.Vault;
Expand Down Expand Up @@ -41,6 +42,7 @@ public void initialize() {
var translationKey = switch (e) {
case MountPointNotSupportedException x -> "unlock.error.customPath.description.notSupported";
case MountPointNotExistsException x -> "unlock.error.customPath.description.notExists";
case MountPointInUseException x -> "unlock.error.customPath.description.inUse";
default -> "unlock.error.customPath.description.generic";
};
dialogDescription.setFormat(resourceBundle.getString(translationKey));
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/i18n/strings.properties
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ unlock.success.revealBtn=Reveal Drive
unlock.error.customPath.message=Unable to mount vault to custom path
unlock.error.customPath.description.notSupported=If you wish to keep using the custom path, please go to the preferences and select a volume type that supports it. Otherwise, go to the vault options and choose a supported mount point.
unlock.error.customPath.description.notExists=The custom mount path does not exist. Either create it in your local filesystem or change it in the vault options.
unlock.error.customPath.description.inUse=Drive letter "%s" is already in use.
unlock.error.customPath.description.generic=You have selected a custom mount path for this vault, but using it failed with the message: %s
## Hub
hub.noKeychain.message=Unable to access device key
Expand Down
10 changes: 9 additions & 1 deletion suppression.xml
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,12 @@
<cve>CVE-2022-45688</cve>
</suppress>

</suppressions>
<suppress>
<notes><![CDATA[
False positive for jackson-databind-2.14.2.jar, see https://github.com/FasterXML/jackson-databind/issues/3972
]]></notes>
<packageUrl regex="true">^pkg:maven/com\.fasterxml\.jackson\.core/jackson\-databind@.*$</packageUrl>
<cve>CVE-2023-35116</cve>
</suppress>

</suppressions>