wentao lu created CMIS-1071:
-------------------------------

             Summary: filename are not set correctly on setContentStream
                 Key: CMIS-1071
                 URL: https://issues.apache.org/jira/browse/CMIS-1071
             Project: Chemistry
          Issue Type: Bug
          Components: portcmis
    Affects Versions: PortCMIS 0.3.0
            Reporter: wentao lu


When use setContentStream, it does not be able to set the "Content-Disposition" 
header for some reasons. Please see below http message:

PUT 
/cmis/atom/myrepository/content?id=idd_5087C169-0000-C515-9FB6-06967D7BF1C1&changeToken=0&overwriteFlag=false
 HTTP/1.1
User-Agent: Apache-Chemistry-PortCMIS/0.3
Content-Type: plain/text; charset=utf-8
Authorization: Basic ZWNtY2VhZG1pbjpEZXYxUGFzc3dvcmQ=
Host: localhost:4001
Cookie: 
JSESSIONID=NqDBh0uyDIVrJvW0verrXFETDy4u_4IqSnJyDN2DOmIAxOrT2qSe!1962713399
Transfer-Encoding: chunked
Expect: 100-continue

9
BANANA!!!
0

 

When call setContentStream using DotCMIS, it is able to set the file name via 
"Content-Disposition" header.

PUT 
/cmis/atom/myrepository/content?id=idd_3089C569-0000-CE17-9119-FAC31AF1A146&changeToken=0&overwriteFlag=true
 HTTP/1.1
User-Agent: Apache Chemistry DotCMIS
Content-Type: application/msword
Content-Disposition: attachment; 
filename*=UTF-8''AER%20New%20Use%20Cases%20-%20Draft.docx
Authorization: Basic ZWNtY2VhZG1pbjpEZXYxUGFzc3dvcmQ=
Host: localhost:4001
Cookie: 
JSESSIONID=GWfFiTPPl2s2LLYLIh5-gN82XaJZ5rk3wPQz4ORtnm2ADmQJXhpn!1962713399
Transfer-Encoding: chunked
Expect: 100-continue

When reviewing the code, it looks like the issue occurred on line 156 of 
HttpPortable.cs

request.Headers.TryAddWithoutValidation(header.Key, header.Value);

request is HttpRequestMessage

On DotCMIS, it use:

conn.Headers.Add(header.Key, header.Value);

conn is HttpWebRequest.

 

Another different I see between DotCMIS and PortCMIS is the "content-type" 
header,

DotCMIS get what it is from mimetype, i.e. 

    Content-Type: application/msword

However PortCMIS automatically add "charset=utf-8" which not always we want, 

    Content-Type: plain/text; charset=utf-8

We'd like developer can control what's been set in the header, if they need to 
add "charset", they can do it:

string mimetype = "text/plain; charset=UTF-8";   //or

string mimetype2 = "text/plain";  

contentStream.MimeType = mimetype;

 

Thanks

 



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to