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

check if folder exist first. #2789

Merged
merged 1 commit into from
Jul 23, 2022
Merged
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
7 changes: 2 additions & 5 deletions bin/v-change-web-domain-docroot
Original file line number Diff line number Diff line change
Expand Up @@ -86,15 +86,12 @@ else
# Check for existence of specified directory under target domain's public_html folder
target_domain_directory="$HOMEDIR/$user/web/$target_domain"
if [ -n "$target_directory" ]; then

# Checking destination path
real_target_directory="$(readlink -e "${target_domain_directory}/public_html/$target_directory/")"
if [ -z "$(echo $real_target_directory | egrep "^$target_domain_directory\b")" ]; then
check_result "$E_FORBIDEN" "Target dir outside of target domain dir"
fi

if [ ! -e "$real_target_directory" ]; then
check_result "$E_NOTEXIST" "Directory $target_directory does not exist under $HOMEDIR/$user/$target_domain/public_html/."
elif [ -z "$(echo $real_target_directory | egrep "^$target_domain_directory\b")" ]; then
check_result "$E_FORBIDEN" "Target dir outside of target domain dir"
else
CUSTOM_DOCROOT="$real_target_directory"
if [ -n "$php" ]; then
Expand Down