Fix user ID encoding for empty string
This commit is contained in:
@@ -48,9 +48,8 @@ func EncodeID(id string) string {
|
||||
|
||||
// hashWithFallback tries to has val with hash.Hash and fallback to crc if needed
|
||||
func hashWithFallback(h hash.Hash, val string) string {
|
||||
|
||||
if reValidSha.MatchString(val) {
|
||||
return val // already hashed or empty
|
||||
if len(val) == 0 || reValidSha.MatchString(val) {
|
||||
return val // empty or already hashed
|
||||
}
|
||||
|
||||
if _, err := io.WriteString(h, val); err != nil {
|
||||
|
||||
Reference in New Issue
Block a user