From f0a703baa7bbfe8b38c064eeaaf4b61987111b16 Mon Sep 17 00:00:00 2001 From: Equim Date: Wed, 28 Feb 2018 01:06:23 +0800 Subject: [PATCH] feat: 6 bytes version of share link, close #331 --- http/share.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/http/share.go b/http/share.go index 6b95d0dd..df307a17 100644 --- a/http/share.go +++ b/http/share.go @@ -1,7 +1,7 @@ package http import ( - "encoding/hex" + "encoding/base64" "net/http" "path/filepath" "strconv" @@ -67,12 +67,12 @@ func sharePostHandler(c *fm.Context, w http.ResponseWriter, r *http.Request) (in } } - bytes, err := fm.GenerateRandomBytes(32) + bytes, err := fm.GenerateRandomBytes(6) if err != nil { return http.StatusInternalServerError, err } - str := hex.EncodeToString(bytes) + str := base64.URLEncoding.EncodeToString(bytes) s = &fm.ShareLink{ Path: path,