Skip to content

Commit 5889254

Browse files
committed
Fix SSH remotes not translating to project URL correctly
1 parent fa2767d commit 5889254

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/main/java/net/minecraftforge/gitver/internal/GitUtils.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -567,14 +567,14 @@ static String buildProjectUrl(String domain, String organization, String project
567567
//Grab its string representation and process.
568568
var originUrlString = originUrl.toString();
569569
//Determine the protocol
570-
if (originUrlString.startsWith("ssh")) {
570+
if (originUrlString.lastIndexOf(':') > "https://".length()) {
571571
//If ssh then check for authentication data.
572572
if (originUrlString.contains("@")) {
573573
//We have authentication data: Strip it.
574-
return "https://" + originUrlString.substring(originUrlString.indexOf("@") + 1).replace(".git", "");
574+
return "https://" + originUrlString.substring(originUrlString.indexOf("@") + 1).replace(".git", "").replace(':', '/');
575575
} else {
576576
//No authentication data: Switch to https.
577-
return "https://" + originUrlString.substring(6).replace(".git", "");
577+
return "https://" + originUrlString.replace("ssh://", "").replace(".git", "").replace(':', '/');
578578
}
579579
} else if (originUrlString.startsWith("http")) {
580580
//Standard http protocol: Strip the ".git" ending only.

0 commit comments

Comments
 (0)