[ 
https://issues.apache.org/jira/browse/JCRVLT-186?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16066160#comment-16066160
 ] 

Tobias Bocanegra commented on JCRVLT-186:
-----------------------------------------

cool idea. however, if I "disable" the chunked encoding by altering the body 
part:

{noformat}
index e4ddbf261..52b5308c5 100644
--- 
a/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2davex/Utils.java
+++ 
b/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2davex/Utils.java
@@ -98,7 +99,15 @@ final class Utils {
         switch (value.getType()) {
             case PropertyType.BINARY:
                 binaries.add(value);
-                part = builder.setBody(new InputStreamBody(value.getStream(), 
ctype)).build();
+                Binary bin = value.getBinary();
+                long size = bin.getSize();
+                byte[] data = new byte[(int) size];
+                try {
+                    bin.read(data, 0);
+                } catch (IOException e) {
+                    throw new RepositoryException(e);
+                }
+                part = builder.setBody(new ByteArrayBody(data, ctype, 
"binary")).build();
{noformat}

the upload works.

> rcp fails to copy binaries correctly
> ------------------------------------
>
>                 Key: JCRVLT-186
>                 URL: https://issues.apache.org/jira/browse/JCRVLT-186
>             Project: Jackrabbit FileVault
>          Issue Type: Bug
>          Components: RCP
>    Affects Versions: 3.1.38
>            Reporter: Tobias Bocanegra
>            Priority: Critical
>
> coping a binary, eg. an image results in data corruption, probably dues to 
> wrong charset setting in the webdav POST:
> {noformat}2017-06-28T15:01:31.114+09:00
> --PuVe35GoHu1NaGvsEEeuI3O1LXf5jbJ
> Content-Disposition: form-data; 
> name="/content/dam/dst/test.png/jcr:content/renditions/cq5dam.web.1280.1280.png/jcr:content/jcr:data"
> Content-Type: jcr-value/binary; charset=UTF-8
> Content-Transfer-Encoding: binary
> ‰PNG
> ....
> {noformat}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to