Uploaded image for project: 'Chemistry (Retired)'
  1. Chemistry (Retired)
  2. CMIS-1071

filename are not set correctly on setContentStream

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • PortCMIS 0.3.0
    • None
    • portcmis
    • None

    Description

      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

       

      Attachments

        Activity

          People

            fmui Florian Müller
            welu wentao lu
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated: