Skip to content

Commit b6d2318

Browse files
fix
1 parent 6e15050 commit b6d2318

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

src/redirect/checks.sh

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
#!/bin/bash
2424
source $GITHUB_ACTION_PATH/src/modules/errmsg.sh
2525
source $GITHUB_ACTION_PATH/src/modules/color.sh
26+
2627
config=$(cat just.config.json)
2728

2829
redirect_config_=$(echo "$config" | jq -r '.redirect_config')
@@ -32,8 +33,7 @@ if ! echo "$config" | jq -e '.redirect_config' > /dev/null; then
3233
fi
3334

3435
validate_redirect_config() {
35-
local url=$(echo "$config" | jq -r '.redirect_config.url' > /dev/null)
36-
if [[ -z "$url" ]]; then
36+
if ! echo "$config" | jq -e '.redirect_config.url' > /dev/null; then
3737
local ERROR_MESSAGE=$(ErrorMessage "redirect/checks.sh" "0114")
3838
echo -e "$ERROR_MESSAGE" && exit 1
3939
fi
@@ -44,15 +44,16 @@ validate_paths() {
4444
if [[ -n "$paths" ]]; then
4545
local countt=0
4646
for path in $paths; do
47-
local url=$(echo "$path" | jq -r '.url')
48-
local path_=$(echo "$path" | jq -r '.path_')
49-
if [[ -z "$url" ]]; then
47+
if ! echo "$path" | jq -e '.url' > /dev/null; then
5048
local ERROR_MESSAGE=$(customErrorMessage "Error" "0115" "Missing \"url\" in item #$countt in \"paths\" in \"redirect_config\" in \"module.exports\" at \"just.config.js\" file.")
5149
echo -e "$_RED$ERROR_MESSAGE$_RESET" && exit 1
52-
elif [[ -z "$path_" ]]; then
53-
local ERROR_MESSAGE= $(customErrorMessage "Error" "0116" "Missing \"path_\" in item #$countt in \"paths\" in \"redirect_config\" in \"module.exports\" at \"just.config.js\" file.")
50+
fi
51+
52+
if ! echo "$path" | jq -e '.path_' > /dev/null; then
53+
local ERROR_MESSAGE=$(customErrorMessage "Error" "0116" "Missing \"path_\" in item #$countt in \"paths\" in \"redirect_config\" in \"module.exports\" at \"just.config.js\" file.")
5454
echo -e "$_RED$ERROR_MESSAGE$_RESET" && exit 1
5555
fi
56+
5657
countt=$((countt + 1))
5758
done
5859
fi

0 commit comments

Comments
 (0)