Albirew/nyaa-pantsu
Archivé
1
0
Bifurcation 0

Update uploadHandler.go

Cette révision appartient à :
Akatsuki-Ousawa 2017-05-18 22:14:14 +02:00 révisé par GitHub
Parent bba5faa58a
révision e86627abed

Voir le fichier

@ -17,16 +17,22 @@ import (
func UploadHandler(w http.ResponseWriter, r *http.Request) {
user := GetUser(r)
if config.UploadsDisabled && config.AdminsAreStillAllowedTo && user.Status != 2 && config.TrustedUsersAreStillAllowedTo && user.Status != 1 {
http.Error(w, "Error uploads are disabled", http.StatusInternalServerError)
return
} else if config.UploadsDisabled && !config.AdminsAreStillAllowedTo && user.Status == 2 {
http.Error(w, "Error uploads are disabled", http.StatusInternalServerError)
return
} else if config.UploadsDisabled && !config.TrustedUsersAreStillAllowedTo && user.Status == 1 {
http.Error(w, "Error uploads are disabled", http.StatusInternalServerError)
return
if config.UploadsDisabled {
if config.AdminsAreStillAllowedTo && user.Status != 2 && config.TrustedUsersAreStillAllowedTo && user.Status != 1 {
http.Error(w, "Error uploads are disabled", http.StatusInternalServerError)
return
} else if !config.AdminsAreStillAllowedTo && user.Status == 2 {
http.Error(w, "Error uploads are disabled", http.StatusInternalServerError)
return
} else if !config.TrustedUsersAreStillAllowedTo && user.Status == 1 {
http.Error(w, "Error uploads are disabled", http.StatusInternalServerError)
return
}
}
var uploadForm UploadForm
if r.Method == "POST" {
defer r.Body.Close()