Skip to content

Commit f7a7e81

Browse files
authored
Merge pull request #1711 from ethan-hgwr/fix/setup-fork.sh
fix(setup-fork): set count to 0 if it is non numeric
2 parents e84cd1d + 321631a commit f7a7e81

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

docs/contribution/setup-fork.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,11 @@ update_links() {
124124
# Count occurrences of the old repo URL
125125
local count=$(grep -c "community-scripts/ProxmoxVED" "$file" 2>/dev/null || echo 0)
126126

127+
# Set to 0 if count is non numeric
128+
if ! [[ "$count" =~ ^[0-9]+$ ]]; then
129+
count=0
130+
fi
131+
127132
if [[ $count -gt 0 ]]; then
128133
# Replace all variations of the URL
129134
sed -i "s|github.com/$old_repo/$old_name|github.com/$new_owner/$new_repo|g" "$file"
@@ -140,6 +145,11 @@ update_links() {
140145
if [[ -f "$file" ]]; then
141146
local count=$(grep -c "community-scripts/ProxmoxVED" "$file" 2>/dev/null || echo 0)
142147

148+
# Set to 0 if count is non numeric
149+
if ! [[ "$count" =~ ^[0-9]+$ ]]; then
150+
count=0
151+
fi
152+
143153
if [[ $count -gt 0 ]]; then
144154
sed -i "s|github.com/$old_repo/$old_name|github.com/$new_owner/$new_repo|g" "$file"
145155
sed -i "s|raw.githubusercontent.com/$old_repo/$old_name|raw.githubusercontent.com/$new_owner/$new_repo|g" "$file"

0 commit comments

Comments
 (0)