cryptomator / cli

Cryptomator Command-Line Interface
GNU Affero General Public License v3.0
287 stars 43 forks source link

Does not work on vaults with spaces in the file path #27

Closed sharjeelsayed closed 3 weeks ago

sharjeelsayed commented 5 years ago

Does not work on vault paths with spaces in the file path if you pass it as a bash variable.I tried escaping with \ and quotes( double and single too) but doesn't work. This is on MacOS Mojave with the latest bash 5.0.2(1)

java -version openjdk version "12" 2019-03-19 OpenJDK Runtime Environment (build 12+33) OpenJDK 64-Bit Server VM (build 12+33, mixed mode, sharing)

e.g. CRYPTOMATOR_PATH="cryptomator-cli-0.3.1.jar" MOUNTPATH="$HOME/VAULT$RANDOM" VAULT_PATH="/Users/abc/some drive/abcvault"

VAULT_PATH="/Users/abc/some\ drive/abcvault"

VAULT_PATH='/Users/abc/some drive/abcvault'

VAULT_PASSWORD="secret;" VAULT_NAME="abcvault" BIND_HOST="localhost" BIND_PORT="8198"

/usr/bin/java -jar $CRYPTOMATOR_PATH --vault $VAULT_NAME=$VAULT_PATH --password $VAULT_NAME=$VAULT_PASSWORD --bind $BIND_HOST --port $BIND_PORT

[main] ERROR org.cryptomator.cli.CryptomatorCli - Not a directory: /Users/abc/some

overheadhunter commented 5 years ago

Seems to be a bug in Apache Commons CLI. It seems to work on some systems (depending on which shell you use...?)

But even it it worked, you'd need to quote the string. Since your quotes are already "used" during the variable assignment, they no longer exist when executing java. So you'd probably need to double quote the string:

VAULT_PATH="/Users/abc/some drive/abcvault"
# VAULT_PATH is now: /Users/abc/some drive/abcvault

VAULT_PATH="\"/Users/abc/some drive/abcvault\""
# VAULT_PATH is now: "/Users/abc/some drive/abcvault"
infeo commented 3 weeks ago

We will rewrite the project in a different framework, throwing the old code away making this issue obsolete.