updated .gitignore, improved main.go
This commit is contained in:
parent
b8c2940be6
commit
6483240963
4
.gitignore
vendored
4
.gitignore
vendored
@ -1 +1,3 @@
|
|||||||
files/
|
files/
|
||||||
|
dbfile.db
|
||||||
|
hardfile
|
||||||
|
13
main.go
13
main.go
@ -124,9 +124,6 @@ func UploadHandler(w http.ResponseWriter, r *http.Request) {
|
|||||||
var expiryTime int64
|
var expiryTime int64
|
||||||
var fileNameLength int
|
var fileNameLength int
|
||||||
|
|
||||||
fileNameLength = 0
|
|
||||||
expiryTime = 0
|
|
||||||
|
|
||||||
file, _, err := r.FormFile("file")
|
file, _, err := r.FormFile("file")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
w.WriteHeader(http.StatusBadRequest)
|
w.WriteHeader(http.StatusBadRequest)
|
||||||
@ -153,10 +150,7 @@ func UploadHandler(w http.ResponseWriter, r *http.Request) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
|
|
||||||
// Default to conf if not present
|
|
||||||
if expiryTime == 0 {
|
|
||||||
expiryTime = int64(conf.FileExpirySeconds)
|
expiryTime = int64(conf.FileExpirySeconds)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -172,10 +166,7 @@ func UploadHandler(w http.ResponseWriter, r *http.Request) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
|
|
||||||
// Default to conf if not present
|
|
||||||
if fileNameLength == 0 {
|
|
||||||
fileNameLength = conf.FileLen
|
fileNameLength = conf.FileLen
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user