Jelajahi Sumber

Merge pull request #37174 from thaJeztah/no_additional_magic_matching

Be explicit about github.com prefix being a legacy feature
Vincent Demeester 7 tahun lalu
induk
melakukan
2ea4ece674
1 mengubah file dengan 9 tambahan dan 1 penghapusan
  1. 9 1
      pkg/urlutil/urlutil.go

+ 9 - 1
pkg/urlutil/urlutil.go

@@ -9,7 +9,15 @@ import (
 
 var (
 	validPrefixes = map[string][]string{
-		"url":       {"http://", "https://"},
+		"url": {"http://", "https://"},
+
+		// The github.com/ prefix is a special case used to treat context-paths
+		// starting with `github.com` as a git URL if the given path does not
+		// exist locally. The "github.com/" prefix is kept for backward compatibility,
+		// and is a legacy feature.
+		//
+		// Going forward, no additional prefixes should be added, and users should
+		// be encouraged to use explicit URLs (https://github.com/user/repo.git) instead.
 		"git":       {"git://", "github.com/", "git@"},
 		"transport": {"tcp://", "tcp+tls://", "udp://", "unix://", "unixgram://"},
 	}