Replaced math/rand (deprecated) with crypto/rand
This commit is contained in:
parent
14e947435b
commit
7cc0152d3e
4
main.go
4
main.go
@ -1,8 +1,8 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"crypto/rand"
|
||||||
"io"
|
"io"
|
||||||
"math/rand"
|
|
||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
"strconv"
|
"strconv"
|
||||||
@ -138,7 +138,6 @@ func UploadHandler(w http.ResponseWriter, r *http.Request) {
|
|||||||
}
|
}
|
||||||
file.Seek(0, 0)
|
file.Seek(0, 0)
|
||||||
|
|
||||||
|
|
||||||
// Check if expiry time is present and length is too long
|
// Check if expiry time is present and length is too long
|
||||||
if r.PostFormValue("expiry") != "" {
|
if r.PostFormValue("expiry") != "" {
|
||||||
ttl, err = strconv.ParseInt(r.PostFormValue("expiry"), 10, 64)
|
ttl, err = strconv.ParseInt(r.PostFormValue("expiry"), 10, 64)
|
||||||
@ -177,7 +176,6 @@ func UploadHandler(w http.ResponseWriter, r *http.Request) {
|
|||||||
fileNameLength = conf.FileLen
|
fileNameLength = conf.FileLen
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// generate + check name
|
// generate + check name
|
||||||
for {
|
for {
|
||||||
id := NameGen(fileNameLength)
|
id := NameGen(fileNameLength)
|
||||||
|
Loading…
Reference in New Issue
Block a user