feat: 6 bytes version of share link, close #331
parent
a184b775b3
commit
f0a703baa7
|
@ -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