Skip to content
Closed
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
6 changes: 2 additions & 4 deletions apps/website/public/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@ detect_version() {
echo "Detecting latest stable version from GitHub..." >&2

# Try to get latest release from GitHub by following redirects
version=$(curl -fsSL -o /dev/null -w '%{url_effective}\n' \
https://github.com/dokploy/dokploy/releases/latest 2>/dev/null | \
sed 's#.*/tag/##')
version=$(curl -s https://api.github.com/repos/dokploy/dokploy/releases/latest | grep "\"tag_name\":" | cut -d "\"" -f 4)
Copy link

Choose a reason for hiding this comment

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

GitHub API rate limit (60 req/hour unauthenticated) will cause failures for users. The previous redirect-following approach didn't count against API limits.

Suggested change
version=$(curl -s https://api.github.com/repos/dokploy/dokploy/releases/latest | grep "\"tag_name\":" | cut -d "\"" -f 4)
version=$(curl -fsSL -o /dev/null -w '%{url_effective}\n' \
https://github.com/dokploy/dokploy/releases/latest 2>/dev/null | \
sed 's#.*/tag/##')

Copy link

Choose a reason for hiding this comment

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

Missing -f flag means curl won't fail on HTTP errors (403, 404, etc). HTTP errors will pass through to grep and fail silently.

Suggested change
version=$(curl -s https://api.github.com/repos/dokploy/dokploy/releases/latest | grep "\"tag_name\":" | cut -d "\"" -f 4)
version=$(curl -fsSL https://api.github.com/repos/dokploy/dokploy/releases/latest 2>/dev/null | grep "\"tag_name\":" | cut -d "\"" -f 4)

Copy link

Choose a reason for hiding this comment

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

Parsing JSON with grep | cut is fragile. Consider using jq with fallback:

version=$(curl -fsSL https://api.github.com/repos/dokploy/dokploy/releases/latest 2>/dev/null | jq -r '.tag_name // empty' 2>/dev/null || \
    curl -fsSL -o /dev/null -w '%{url_effective}\n' https://github.com/dokploy/dokploy/releases/latest 2>/dev/null | sed 's#.*/tag/##')


# Fallback to latest tag if detection fails
if [ -z "$version" ]; then
Expand Down Expand Up @@ -361,4 +359,4 @@ if [ "$1" = "update" ]; then
update_dokploy
else
install_dokploy
fi
fi
Loading