Skip to content

Commit

Permalink
Fix lint; Add comment
Browse files Browse the repository at this point in the history
  • Loading branch information
ps-jay committed Aug 31, 2024
1 parent dbf9c56 commit 233fed5
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions shared.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,15 @@ remove_prefix() {
if [[ -n "${tag_prefix:-}" ]]; then
# Escape special characters in tag_prefix
local escaped_prefix
escaped_prefix=$(printf '%s\n' "$tag_prefix" | sed 's/[][\/.^$*]/\\&/g')
escaped_prefix=$(printf '%s\n' "$tag_prefix" | sed 's/[][\/.^$*]/\\&/g') # special chars matched by sed: ] [ / . ^ $ *

# shellcheck disable=SC2143
if [[ -z "$(echo "${tag}" | grep "^${tag_prefix}")" ]] ; then
echo ""
return
fi
# Use | as the delimiter to avoid conflicts with /
echo "${tag}" | sed "s|^${escaped_prefix}||"
# shellcheck disable=SC2001
echo "${tag}" | sed "s|^${escaped_prefix}||" # Use | as the delimiter to avoid conflicts with /
else
echo "${tag}"
fi
Expand Down

0 comments on commit 233fed5

Please sign in to comment.