From 77a6bc9413e3d0481c2029c75738a659de58be93 Mon Sep 17 00:00:00 2001 From: Matt Baer Date: Thu, 29 Nov 2018 10:22:01 -0500 Subject: [PATCH] Truncate IDs to a more reasonable length --- paste.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/paste.go b/paste.go index c48dc73..313637c 100644 --- a/paste.go +++ b/paste.go @@ -45,7 +45,7 @@ func createPost(w http.ResponseWriter, r *http.Request) { data := r.FormValue("stuff") h := md5.New() idHash := h.Sum([]byte(data)) - id := base64.StdEncoding.EncodeToString(idHash) + id := base64.StdEncoding.EncodeToString(idHash)[:20] err := ioutil.WriteFile(id+".txt", []byte(data), 0600) if err != nil {