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

Phil Barr commented on CMIS-512:
--------------------------------

I changed the constructor that takes an HttpWebResponse in HTTP.Response in 
http.cs (line 175) to the following to fix this:
{code}
public Response(HttpWebResponse httpResponse)
{
    this.response = httpResponse;
    StatusCode = httpResponse.StatusCode;
    Message = httpResponse.StatusDescription;
    ContentType = httpResponse.ContentType;
    ContentLength = httpResponse.ContentLength == -1 ? null : 
(long?)httpResponse.ContentLength;
    string contentTransferEncoding = 
httpResponse.Headers["Content-Transfer-Encoding"];
    bool isBase64 = contentTransferEncoding != null && 
contentTransferEncoding.Equals("base64", 
StringComparison.CurrentCultureIgnoreCase);

    if (httpResponse.StatusCode == HttpStatusCode.OK ||
        httpResponse.StatusCode == HttpStatusCode.Created ||
        httpResponse.StatusCode == HttpStatusCode.NonAuthoritativeInformation ||
        httpResponse.StatusCode == HttpStatusCode.PartialContent)
    {
        if (isBase64)
        {
            Stream = new BufferedStream(new 
CryptoStream(httpResponse.GetResponseStream(), new FromBase64Transform(), 
CryptoStreamMode.Read ));
        }
        else
        {
            Stream = new BufferedStream(httpResponse.GetResponseStream(), 64 * 
1024);
        }
    }
    else
    {
        try { httpResponse.Close(); }
        catch (Exception) { }
    }
}
{code}
                
> DotCMIS returns unexpected document content when connected to SharePoint 2010 
> via AtomPub
> -----------------------------------------------------------------------------------------
>
>                 Key: CMIS-512
>                 URL: https://issues.apache.org/jira/browse/CMIS-512
>             Project: Chemistry
>          Issue Type: Bug
>          Components: dotcmis
>    Affects Versions: DotCMIS 0.3
>         Environment: Sharepoint 2010
>            Reporter: Phil Barr
>            Assignee: Florian Müller
>              Labels: sharepoint
>
> Same as this bug https://issues.apache.org/jira/browse/CMIS-264 but for 
> DotCMIS.
> SharePoint 2010 delivers document content base64 encoded. OpenCMIS doesn't 
> honor the Content-Transfer-Encoding HTTP header and passes the encoded stream 
> to the application.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira


Reply via email to