From 6d901e4b11a6690c28a80704e26f7349f74d3bcb Mon Sep 17 00:00:00 2001 From: Enes Cakir Date: Thu, 11 Feb 2021 00:24:51 +0300 Subject: [PATCH] Fix user ID encoding for empty string --- backend/app/store/user.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/backend/app/store/user.go b/backend/app/store/user.go index 9d8b28ad..5e5da334 100644 --- a/backend/app/store/user.go +++ b/backend/app/store/user.go @@ -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 {