Explorar o código

improve numeric only id detection

Docker-DCO-1.1-Signed-off-by: Victor Vieux <vieux@docker.com> (github: vieux)
Victor Vieux %!s(int64=11) %!d(string=hai) anos
pai
achega
f2baa364a1
Modificáronse 1 ficheiros con 1 adicións e 1 borrados
  1. 1 1
      utils/utils.go

+ 1 - 1
utils/utils.go

@@ -514,7 +514,7 @@ func GenerateRandomID() string {
 		// if we try to parse the truncated for as an int and we don't have
 		// an error then the value is all numberic and causes issues when
 		// used as a hostname. ref #3869
-		if _, err := strconv.Atoi(TruncateID(value)); err == nil {
+		if _, err := strconv.ParseInt(TruncateID(value), 10, 64); err == nil {
 			continue
 		}
 		return value