From 09ce8b265c45b22f04516f97abc754a110f86675 Mon Sep 17 00:00:00 2001 From: Andreas Mieke Date: Sat, 9 Jun 2018 18:26:21 +0200 Subject: [PATCH] Use at least 2 characters --- routes/routes.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/routes/routes.go b/routes/routes.go index 65f88f2..e0b017b 100644 --- a/routes/routes.go +++ b/routes/routes.go @@ -48,7 +48,7 @@ func Encode(c *gin.Context) { hasher := sha512.New() hasher.Write([]byte(URL.Long.String)) base := base64.StdEncoding.EncodeToString(hasher.Sum(nil)) - i := 1 + i := 2 for { database.Db.Model(&database.URL{}).Where("short = ?", base[0:i]).Count(&count) if count > 0 && i < len(base) {