fix: revert: use CRC32 to shorten app subdomain

This reverts commit 0e28397c82.
This commit is contained in:
Marcin Tojek
2023-10-10 18:12:46 +10:00
committed by GitHub
parent b039dc6989
commit f36fba2486
4 changed files with 6 additions and 24 deletions
+1 -9
View File
@@ -2,7 +2,6 @@ package httpapi
import (
"fmt"
"hash/crc32"
"net"
"regexp"
"strings"
@@ -19,8 +18,6 @@ var (
nameRegex))
validHostnameLabelRegex = regexp.MustCompile(`^[a-z0-9]([-a-z0-9]*[a-z0-9])?$`)
crcTable = crc32.MakeTable(crc32.IEEE)
)
// ApplicationURL is a parsed application URL hostname.
@@ -42,12 +39,7 @@ func (a ApplicationURL) String() string {
_, _ = appURL.WriteString(a.WorkspaceName)
_, _ = appURL.WriteString("--")
_, _ = appURL.WriteString(a.Username)
hostname := appURL.String()
if len(hostname) < 64 { // max length for the subdomain level
return hostname
}
return fmt.Sprintf("app-%08x", crc32.Checksum([]byte(hostname), crcTable))
return appURL.String()
}
// ParseSubdomainAppURL parses an ApplicationURL from the given subdomain. If