feat: 6 bytes version of share link, close #331
Former-commit-id: a4a4edf89a32e9b8338474eb3322de69e12da83e [formerly 57124e6118adfbf0ae38ec77ce6816f6351174ad] [formerly 6d9e5b81bf0f52373147cb46d3c71d7e8e1362a7 [formerly f0a703baa7bbfe8b38c064eeaaf4b61987111b16]] Former-commit-id: 7da431b8bf791bdfe66fca2b0f87fc4b4918543b [formerly 4d02e3f0a697b912fb639b09857ae5daa0851ebf] Former-commit-id: 87af8b945b414dad82d1c6769d6ec014e097aa22
This commit is contained in:
parent
5eb9e95720
commit
a2fcb8b3b0
|
@ -1,7 +1,7 @@
|
||||||
package http
|
package http
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/hex"
|
"encoding/base64"
|
||||||
"net/http"
|
"net/http"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strconv"
|
"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 {
|
if err != nil {
|
||||||
return http.StatusInternalServerError, err
|
return http.StatusInternalServerError, err
|
||||||
}
|
}
|
||||||
|
|
||||||
str := hex.EncodeToString(bytes)
|
str := base64.URLEncoding.EncodeToString(bytes)
|
||||||
|
|
||||||
s = &fm.ShareLink{
|
s = &fm.ShareLink{
|
||||||
Path: path,
|
Path: path,
|
||||||
|
|
Loading…
Reference in New Issue