diff --git a/skills/kugetsu/scripts/kugetsu-session.sh b/skills/kugetsu/scripts/kugetsu-session.sh index 2ee1e89..764a096 100755 --- a/skills/kugetsu/scripts/kugetsu-session.sh +++ b/skills/kugetsu/scripts/kugetsu-session.sh @@ -156,13 +156,11 @@ extract_issue_ref_from_message() { return fi - if [[ "$message" =~ (https?://[a-zA-Z0-9.-]+/[a-zA-Z0-9._-]+/[a-zA-Z0-9._-]+/(issues|pull)/[0-9]+) ]]; then - local url="${BASH_REMATCH[1]}" - local path=$(echo "$url" | sed 's|https\?://||' | cut -d'/' -f2-) - local instance=$(echo "$path" | cut -d'/' -f1) - local owner=$(echo "$path" | cut -d'/' -f2) - local repo=$(echo "$path" | cut -d'/' -f3) - local num=$(echo "$path" | grep -oE '[0-9]+$') + if [[ "$message" =~ (https?://)?([a-zA-Z0-9.-]+)/([a-zA-Z0-9._-]+)/([a-zA-Z0-9._-]+)/(issues|pull)/([0-9]+) ]]; then + local instance="${BASH_REMATCH[2]}" + local owner="${BASH_REMATCH[3]}" + local repo="${BASH_REMATCH[4]}" + local num="${BASH_REMATCH[6]}" echo "${instance}/${owner}/${repo}#${num}" return fi