specify-expiry-and-urllen #2

Closed
Ghost wants to merge 4 commits from (deleted):specify-expiry-and-urllen into main
2 changed files with 5 additions and 12 deletions
Showing only changes of commit 6483240963 - Show all commits

4
.gitignore vendored
View File

@ -1 +1,3 @@
files/ files/
dbfile.db
hardfile

13
main.go
View File

@ -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
} }