Truncate IDs to a more reasonable length
This commit is contained in:
parent
62979dbe9b
commit
77a6bc9413
2
paste.go
2
paste.go
@ -45,7 +45,7 @@ func createPost(w http.ResponseWriter, r *http.Request) {
|
|||||||
data := r.FormValue("stuff")
|
data := r.FormValue("stuff")
|
||||||
h := md5.New()
|
h := md5.New()
|
||||||
idHash := h.Sum([]byte(data))
|
idHash := h.Sum([]byte(data))
|
||||||
id := base64.StdEncoding.EncodeToString(idHash)
|
id := base64.StdEncoding.EncodeToString(idHash)[:20]
|
||||||
|
|
||||||
err := ioutil.WriteFile(id+".txt", []byte(data), 0600)
|
err := ioutil.WriteFile(id+".txt", []byte(data), 0600)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user