Browse Source

Merge branch 'mutantmonkey-safeuris'

pull/25/head
andreimarcu 9 years ago
parent
commit
5aa8ed011f
  1. 5
      upload.go

5
upload.go

@ -16,6 +16,7 @@ import (
"strings" "strings"
"bitbucket.org/taruti/mimemagic" "bitbucket.org/taruti/mimemagic"
"github.com/dchest/uniuri"
"github.com/zenazn/goji/web" "github.com/zenazn/goji/web"
) )
@ -219,7 +220,7 @@ func processUpload(upReq UploadRequest) (upload Upload, err error) {
// If no delete key specified, pick a random one. // If no delete key specified, pick a random one.
if upReq.deletionKey == "" { if upReq.deletionKey == "" {
upload.DeleteKey = randomString(30)
upload.DeleteKey = uniuri.NewLen(30)
} else { } else {
upload.DeleteKey = upReq.deletionKey upload.DeleteKey = upReq.deletionKey
} }
@ -240,7 +241,7 @@ func processUpload(upReq UploadRequest) (upload Upload, err error) {
} }
func generateBarename() string { func generateBarename() string {
return randomString(8)
return uniuri.NewLenChars(8, []byte("abcdefghijklmnopqrstuvwxyz0123456789"))
} }
func generateJSONresponse(upload Upload) []byte { func generateJSONresponse(upload Upload) []byte {

Loading…
Cancel
Save