Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions padd.sh
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ LoginAPI() {
Authenticate

# Try to login again until the session is valid
while [ "${validSession}" != true ] ; do
while [ "${validSession}" = false ] ; do
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure about this change. validSession is set by Authenticate() which get it from

https://github.com/mwoolweaver/PADD/blob/16423a6b6ada5e2a436d6b1ffdd79f4dd110a14d/padd.sh#L300C5-L300C17

If anything goes wrong, it might contain something unexpected or is empty. Therefore, I would keep this check as it was

Copy link
Copy Markdown
Member

@rdwebdesign rdwebdesign Mar 17, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree.

If the curl command (in Authenticate() function) fails with an error message instead of a JSON payload, then jq will also fail.
In this case, validSession will be an empty string and the comparison will return different values.

export validSession=''

if [ "${validSession}" != true ]; then echo "try again"; else echo "stop the loop"; fi

This will print try again.

if [ "${validSession}" = false ]; then echo "try again"; else echo "stop the loop"; fi

This will print stop the loop.

Your command expects the same result in both cases, but we get the opposite when we have a string different than "true" or "false".

We are basically comparing strings here. We want to try again if validSession contains anything different than true, not only when validSession is exactly false.

moveXOffset; echo "Authentication failed."

# Print the error message if there is one
Expand Down Expand Up @@ -1528,7 +1528,7 @@ check_dependencies() {
hasDeps=false
fi

if [ "${hasDeps}" != true ]; then
if [ "${hasDeps}" = false ]; then
printf "%b" "\n Please install the missing dependencies noted above.\n"
exit 1
fi
Expand Down