From 6e8ceb3928ecfb7d24604a0a6793c3cb212552bd Mon Sep 17 00:00:00 2001 From: Aakash Prakash Date: Sat, 23 Feb 2019 16:39:41 +0530 Subject: [PATCH 1/2] Fixes #6 --- Lib/src/com/froala/editor/S3.java | 2 +- Lib/src/com/froala/editor/Utils.java | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/Lib/src/com/froala/editor/S3.java b/Lib/src/com/froala/editor/S3.java index 14b0424..212d70f 100644 --- a/Lib/src/com/froala/editor/S3.java +++ b/Lib/src/com/froala/editor/S3.java @@ -56,7 +56,7 @@ public final static Map getHash(S3Config config) throws Exceptio String dateString = dt.format(now); - String credential = String.join("/", new String[] { accessKey, dateString, region, "s3/aws4_request" }); + String credential = Utils.join("/", new String[] { accessKey, dateString, region, "s3/aws4_request" }); String xAmzDate = dateString + "T000000Z"; SimpleDateFormat isoDt = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.000'Z'"); diff --git a/Lib/src/com/froala/editor/Utils.java b/Lib/src/com/froala/editor/Utils.java index 3cb6a8c..8890891 100644 --- a/Lib/src/com/froala/editor/Utils.java +++ b/Lib/src/com/froala/editor/Utils.java @@ -63,4 +63,17 @@ public static byte[] hmac(byte[] key, String data) throws Exception { public static String hmac_hex(byte[] key, String data) throws Exception { return new String(Hex.encodeHex(hmac(key, data))); } + + public static String join(String delimiter, String[] elements) { + String res = ""; + + for(int i = 0; i < elements.length; i++) { + if(i > 0) { + res += delimiter; + } + res += elements[i]; + } + + return res; + } } From e2258b8c8d5309e23d4042503fb0de29f3a118ce Mon Sep 17 00:00:00 2001 From: Aakash Prakash Date: Fri, 5 Apr 2019 00:56:14 +0530 Subject: [PATCH 2/2] Increase image/video upload load time to 10 secs --- Examples/src/com/froala/examples/servlets/UploadImage.java | 4 ++-- Examples/src/com/froala/examples/servlets/UploadVideo.java | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Examples/src/com/froala/examples/servlets/UploadImage.java b/Examples/src/com/froala/examples/servlets/UploadImage.java index 74a9176..2c98a7c 100644 --- a/Examples/src/com/froala/examples/servlets/UploadImage.java +++ b/Examples/src/com/froala/examples/servlets/UploadImage.java @@ -49,11 +49,11 @@ protected void doPost(HttpServletRequest request, HttpServletResponse response) responseData = new HashMap(); responseData.put("error", e.toString()); } - // Wait for 5 secs for image upload + // Wait for 10 secs for image upload synchronized (responseData) { try { - responseData.wait(5000); + responseData.wait(10000); String jsonResponseData = new Gson().toJson(responseData); response.setContentType("application/json"); response.setCharacterEncoding("UTF-8"); diff --git a/Examples/src/com/froala/examples/servlets/UploadVideo.java b/Examples/src/com/froala/examples/servlets/UploadVideo.java index ad9e345..4d182bc 100644 --- a/Examples/src/com/froala/examples/servlets/UploadVideo.java +++ b/Examples/src/com/froala/examples/servlets/UploadVideo.java @@ -49,11 +49,11 @@ protected void doPost(HttpServletRequest request, HttpServletResponse response) responseData = new HashMap(); responseData.put("error", e.toString()); } - // Wait for 5 secs for video upload + // Wait for 10 secs for video upload synchronized (responseData) { try { - responseData.wait(5000); + responseData.wait(10000); String jsonResponseData = new Gson().toJson(responseData); response.setContentType("application/json"); response.setCharacterEncoding("UTF-8");