Tools: Use a safer hostname detection

This commit is contained in:
Chris Hennes
2025-06-15 19:26:04 -05:00
committed by Kacper Donat
parent ee91b41a6f
commit 211ef2d48b

View File

@@ -10,6 +10,7 @@
# 2011/02/05: The script was extended to support also Bazaar
import os, sys, re, time, getopt
from urllib.parse import urlparse
import xml.sax
import xml.sax.handler
import xml.sax.xmlreader
@@ -275,9 +276,10 @@ class GitControl(VersionControl):
match = re.match(r"ssh://\S+?@(\S+)", url)
if match is not None:
url = "git://%s" % match.group(1)
parsed_url = urlparse(url)
entryscore = (
url == "git://github.com/FreeCAD/FreeCAD.git",
"github.com" in url,
parsed_url.netloc == "github.com",
branch == self.branch,
branch == "main",
"@" not in url,