Add support for SSH-style git repo addresses (#835)

This allows nodes to be pulled from git repositories that:
1. Require authentication
2. Are located on a computer that does not have any special software
   beyond an SSH server to serve up git repos
3. Are hosted on sites that exclusively allow SSH access

I have also cleaned up the JavaScript regex for identifying valid HTTP
addresses. Due to an unescaped '.' and the lack of a count on the first
group, it wasn't doing a whole lot anyway -- just checking that the very
first character wasn't invalid.
This commit is contained in:
guill
2024-07-04 05:29:40 -07:00
committed by GitHub
parent cac3fde2aa
commit 7e84de1ba0
3 changed files with 13 additions and 6 deletions

View File

@@ -515,10 +515,16 @@ class GitProgress(RemoteProgress):
def is_valid_url(url):
try:
# Check for HTTP/HTTPS URL format
result = urlparse(url)
return all([result.scheme, result.netloc])
except ValueError:
return False
if all([result.scheme, result.netloc]):
return True
finally:
# Check for SSH git URL format
pattern = re.compile(r"^(.+@|ssh:\/\/).+:.+$")
if pattern.match(url):
return True
return False
def gitclone_install(files, instant_execution=False, msg_prefix=''):