From e222a8f291c42bae447c64e36b56e42e1e60b7f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sa=C5=A1o=20Petrovi=C4=8D?= Date: Sat, 17 Mar 2018 09:42:15 +0100 Subject: [PATCH] Checking the response code and not the content --- .../addins/client/fileuploader/MaterialFileUploader.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/gwt/material/design/addins/client/fileuploader/MaterialFileUploader.java b/src/main/java/gwt/material/design/addins/client/fileuploader/MaterialFileUploader.java index 95021b2f1..27030c989 100644 --- a/src/main/java/gwt/material/design/addins/client/fileuploader/MaterialFileUploader.java +++ b/src/main/java/gwt/material/design/addins/client/fileuploader/MaterialFileUploader.java @@ -251,18 +251,18 @@ protected void initDropzone(Element e, Element template, String previews, Elemen code = file.xhr.status; } - if (response.indexOf("401") >= 0) { + if (code.equals("401")) { response = "Unauthorized. Your session may have expired. Log in and try again."; globalResponse = response; UnauthorizedEvent.fire(this, convertUploadFile(file), new UploadResponse(file.xhr.status, file.xhr.statusText, response)); } - if (response.indexOf("404") >= 0) { + if (code.equals("404")) { response = "There is a problem uploading your file."; globalResponse = response; } - if (response.indexOf("500") >= 0) { + if (code.equals("500")) { response = "There is a problem uploading your file."; globalResponse = response; } @@ -749,4 +749,4 @@ public void onMaxFilesExceeded(MaxFilesExceededEvent event) { } }, MaxFilesExceededEvent.getType()); } -} \ No newline at end of file +}