Resolve paths in OnionShare script

This commit is contained in:
thePR0M3TH3AN
2025-06-18 21:56:42 -04:00
parent 85d73a47db
commit 1f46e5aa5f
2 changed files with 7 additions and 3 deletions

View File

@@ -8,7 +8,10 @@ fi
# get subdomain from config
subdomain=$(jq -r '.subdomain' "$CONFIG")
DIR="host/${subdomain}"
# resolve paths to absolute locations so the script works from anywhere
CONFIG="$(realpath "$CONFIG")"
DIR="$(realpath "host/$subdomain")"
if [[ ! -d "$DIR" ]]; then
echo "Directory $DIR not found" >&2
exit 1