From cfa998c1c915b95c8cb133c7ab058fe897585902 Mon Sep 17 00:00:00 2001 From: Daniel Fichtinger Date: Wed, 4 Dec 2024 15:37:53 -0500 Subject: [PATCH] feat: Added checks to prevent entire home directory and config directory from being tracked --- yadmadd.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/yadmadd.sh b/yadmadd.sh index f3c0884..37cdb87 100755 --- a/yadmadd.sh +++ b/yadmadd.sh @@ -25,7 +25,12 @@ for arg in "$@"; do fi # get its absolute path abs=$(realpath "$arg") - # check if it's inside home dir + # Don't allow direct homedir or config dir + if [[ "$abs" == "$HOME" || "$abs" == "$HOME/.config" ]]; then + echo "$AYM Path cannot be home directory or config directory." + exit 1 + fi + # check if /inside/ home dir if [[ "$abs" == "$HOME"* ]]; then # convert to path relative to ~ rel=${abs#"$HOME/"}