Add a dash to the allowed characters for clone

This commit is contained in:
Hans Goor 2024-08-04 10:51:46 +02:00
parent 2da1d30e9e
commit 4f486821bb
Signed by: eyedevelop
SSH key fingerprint: SHA256:Td89veptDEwCV8J3fjqnknNk7SbwzedYhauyC2nFBYg

View file

@ -39,15 +39,15 @@ function clone() {
local url="$1"
local forge owner repo
if [[ "${url}" =~ ^ssh:\/\/[a-zA-Z0-9_]+@([a-zA-Z0-9_.]+):[0-9]+/([a-zA-Z0-9_]+)/([a-zA-Z0-9_]+)(.git)?$ ]]; then
if [[ "${url}" =~ ^ssh:\/\/[a-zA-Z0-9_\-]+@([a-zA-Z0-9_.\-]+):[0-9]+/([a-zA-Z0-9_\-]+)/([a-zA-Z0-9_\-]+)(.git)?$ ]]; then
forge="${match[1]:l}"
owner="${match[2]:l}"
repo="${match[3]:l}"
elif [[ "${url}" =~ ^[a-zA-Z0-9_]+@([a-zA-Z0-9_.]+):([a-zA-Z0-9_]+)\/([a-zA-Z0-9_]+)(.git)?$ ]]; then
elif [[ "${url}" =~ ^[a-zA-Z0-9_\-]+@([a-zA-Z0-9_.\-]+):([a-zA-Z0-9_\-]+)\/([a-zA-Z0-9_\-]+)(.git)?$ ]]; then
forge="${match[1]:l}"
owner="${match[2]:l}"
repo="${match[3]:l}"
elif [[ "${url}" =~ ^https?:\/\/([a-zA-Z0-9_.]+)(:[0-9]+)?\/([a-zA-Z0-9_]+)/([a-zA-Z0-9_]+)(.git)?$ ]]; then
elif [[ "${url}" =~ ^https?:\/\/([a-zA-Z0-9_.\-]+)(:[0-9]+)?\/([a-zA-Z0-9_\-]+)/([a-zA-Z0-9_\-]+)(.git)?$ ]]; then
forge="${match[1]:l}"
owner="${match[3]:l}"
repo="${match[4]:l}"