From e86627abed37b8d015c43eddb9e7241129750650 Mon Sep 17 00:00:00 2001 From: Akatsuki-Ousawa Date: Thu, 18 May 2017 22:14:14 +0200 Subject: [PATCH] Update uploadHandler.go --- router/uploadHandler.go | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/router/uploadHandler.go b/router/uploadHandler.go index 6ed68ed5..dbc0e333 100644 --- a/router/uploadHandler.go +++ b/router/uploadHandler.go @@ -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()