This is an automated email from the ASF dual-hosted git repository.

tallison pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tika.git


The following commit(s) were added to refs/heads/master by this push:
     new e6d1eed  TIKA-2858 -- add actual unicode password -- thanks to Ross 
Johnson for the issue and the test files!
e6d1eed is described below

commit e6d1eed58c0cb21a0b0088589b26c4d8b9233efb
Author: TALLISON <[email protected]>
AuthorDate: Mon Apr 22 16:16:48 2019 -0400

    TIKA-2858 -- add actual unicode password -- thanks to Ross Johnson for
    the issue and the test files!
---
 .../java/org/apache/tika/server/TikaResourceTest.java  |  17 ++++++++++++++++-
 tika-server/src/test/resources/testUnicodePassword.pdf | Bin 0 -> 18849 bytes
 2 files changed, 16 insertions(+), 1 deletion(-)

diff --git 
a/tika-server/src/test/java/org/apache/tika/server/TikaResourceTest.java 
b/tika-server/src/test/java/org/apache/tika/server/TikaResourceTest.java
index 943d083..f811a94 100644
--- a/tika-server/src/test/java/org/apache/tika/server/TikaResourceTest.java
+++ b/tika-server/src/test/java/org/apache/tika/server/TikaResourceTest.java
@@ -427,7 +427,8 @@ public class TikaResourceTest extends CXFTestBase {
     }
 
     @Test
-    public void testUnicodePasswordProtected() throws Exception {
+    public void testUnicodePasswordProtectedSpaces() throws Exception {
+        //TIKA-2858
         final String password = "    ";
         final String encoded = new 
Base64().encodeAsString(password.getBytes(StandardCharsets.UTF_8));
         Response response = WebClient.create(endPoint + TIKA_PATH)
@@ -438,4 +439,18 @@ public class TikaResourceTest extends CXFTestBase {
                 .getEntity());
         assertContains("Just some text.", responseMsg);
     }
+
+    @Test
+    public void testUnicodePasswordProtectedUnicode() throws Exception {
+        //TIKA-2858
+        final String password = "  ! < > \" \\ \u20AC \u0153 \u00A4 
\u0031\u2044\u0034 \u0031\u2044\u0032 \uD841\uDF0E \uD867\uDD98 \uD83D\uDE00  ";
+        final String encoded = new 
Base64().encodeAsString(password.getBytes(StandardCharsets.UTF_8));
+        Response response = WebClient.create(endPoint + TIKA_PATH)
+                .accept("text/plain")
+                .header(TikaResource.PASSWORD_BASE64_UTF8, encoded)
+                
.put(ClassLoader.getSystemResourceAsStream("testUnicodePassword.pdf"));
+        String responseMsg = getStringFromInputStream((InputStream) response
+                .getEntity());
+        assertContains("Just some text.", responseMsg);
+    }
 }
diff --git a/tika-server/src/test/resources/testUnicodePassword.pdf 
b/tika-server/src/test/resources/testUnicodePassword.pdf
new file mode 100644
index 0000000..20e512d
Binary files /dev/null and 
b/tika-server/src/test/resources/testUnicodePassword.pdf differ

Reply via email to