<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Can't download .docx in Alfresco Archive</title>
    <link>https://connect.hyland.com/t5/alfresco-archive/can-t-download-docx/m-p/235821#M188951</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Yet another update….&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; I changed my web service to use Apache commons-ftp and used Alfresco's ftp like this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="language-none line-numbers"&gt;&lt;CODE&gt;//After cwd to the correct directory:&lt;BR /&gt;ByteArrayOutputStream output = new ByteArrayOutputStream();&lt;BR /&gt;ftp.retrieveFile(fileName, output);&lt;BR /&gt;return output.toByteArray();&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;SPAN&gt; And all is well for all files.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This does mean I need to know exactly where the file is and defeats the point of lucene and WebServiceFactory.getContentService();&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I wish to formally apply for a bug. Where does one do this?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 24 Aug 2010 12:15:02 GMT</pubDate>
    <dc:creator>mangar</dc:creator>
    <dc:date>2010-08-24T12:15:02Z</dc:date>
    <item>
      <title>Can't download .docx</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/can-t-download-docx/m-p/235818#M188948</link>
      <description>When I download a docx file, it downloads fine, but when it opens up in Word, it says "file corrupted" I of course click through and Word recovers the document just fine. But I have some VERY upset managers who don't like Alfresco corrupting their documents. It's not of course, because if I go into</description>
      <pubDate>Tue, 03 Aug 2010 18:53:13 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/can-t-download-docx/m-p/235818#M188948</guid>
      <dc:creator>mangar</dc:creator>
      <dc:date>2010-08-03T18:53:13Z</dc:date>
    </item>
    <item>
      <title>Re: Can't download .docx</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/can-t-download-docx/m-p/235819#M188949</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Can you save your downloaded file to disk and then use a binary compare utility to analyse if there is a difference between the file downloaded via your web service and the file downloaded by other means.&amp;nbsp; It may be something like a "magic" byte at the start or a content encoding issue, or different linefeed characters or something else.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 Aug 2010 23:31:48 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/can-t-download-docx/m-p/235819#M188949</guid>
      <dc:creator>mrogers</dc:creator>
      <dc:date>2010-08-03T23:31:48Z</dc:date>
    </item>
    <item>
      <title>Re: Can't download .docx</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/can-t-download-docx/m-p/235820#M188950</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Update:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; It turns out that if I take the exact same InputStream and use the ContentUtils.convertToByteArray(is) and alter the jsp like this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="language-none line-numbers"&gt;&lt;CODE&gt;&lt;BR /&gt;AlfrescoBridge bridge = new AlfrescoBridge(); // my handy class again&lt;BR /&gt;response.reset();&lt;BR /&gt;response.setHeader ("Content-Disposition", "attachment;filename=\""+fileName+"\"");&lt;BR /&gt;ServletOutputStream sosStream = response.getOutputStream();&lt;BR /&gt;sosStream.write(bridge.getFileBites(uuid)); // calls&amp;nbsp; ContentUtils.convertToByteArray(is)&lt;BR /&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;SPAN&gt;It works for &lt;/SPAN&gt;&lt;EM&gt;SOME&lt;/EM&gt;&lt;SPAN&gt; .docx files, but breaks &lt;/SPAN&gt;&lt;EM&gt;ALL&lt;/EM&gt;&lt;SPAN&gt; the other filetypes.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So my full jsp looks basically like this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="language-none line-numbers"&gt;&lt;CODE&gt;&lt;BR /&gt;AlfrescoBridge bridge = new AlfrescoBridge(); // handy class&lt;BR /&gt;response.reset();&lt;BR /&gt;response.setHeader ("Content-Disposition", "attachment;filename=\""+fileName+"\"");&lt;BR /&gt;ServletOutputStream sosStream = response.getOutputStream();&lt;BR /&gt;if(fileName.endsWith("docx")) {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sosStream.write(bridge.getFileBites(fileID));&amp;nbsp;&amp;nbsp;&amp;nbsp;//&amp;nbsp; calls ContentUtils.convertToByteArray(is)&lt;BR /&gt;}&lt;BR /&gt;else {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; InputStream in = bridge.getFileInputStream(fileID);&amp;nbsp; // calls ContentUtils.getContentAsInputStream(contentReadResult[0]);&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; int ibit = 256;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; while ((ibit) &amp;gt;= 0)&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ibit = in.read();&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sosStream.write(ibit);&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR /&gt;&amp;nbsp; sosStream.flush();&lt;BR /&gt;&amp;nbsp; in.close();&lt;BR /&gt;&amp;nbsp; }&lt;BR /&gt;sosStream.close();&lt;BR /&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;SPAN&gt;Again, this only works for some of the docx files, not all. I cannot tell any difference between the documents.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;What makes this more weird is if I go into the regular Alfresco faces app and click on the download button, it works in &lt;/SPAN&gt;&lt;EM&gt;ALL&lt;/EM&gt;&lt;SPAN&gt; situations with no problems.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Im not one to jump on a "bug" bandwagon, but there is clearly a problem with ContentUtils.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I will try the binary comparison, and see if I can gleam anything form that.&amp;nbsp; Do you have a suggestion for a particular tool?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Aug 2010 18:43:59 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/can-t-download-docx/m-p/235820#M188950</guid>
      <dc:creator>mangar</dc:creator>
      <dc:date>2010-08-04T18:43:59Z</dc:date>
    </item>
    <item>
      <title>Re: Can't download .docx</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/can-t-download-docx/m-p/235821#M188951</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Yet another update….&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; I changed my web service to use Apache commons-ftp and used Alfresco's ftp like this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="language-none line-numbers"&gt;&lt;CODE&gt;//After cwd to the correct directory:&lt;BR /&gt;ByteArrayOutputStream output = new ByteArrayOutputStream();&lt;BR /&gt;ftp.retrieveFile(fileName, output);&lt;BR /&gt;return output.toByteArray();&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;SPAN&gt; And all is well for all files.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This does mean I need to know exactly where the file is and defeats the point of lucene and WebServiceFactory.getContentService();&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I wish to formally apply for a bug. Where does one do this?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 Aug 2010 12:15:02 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/can-t-download-docx/m-p/235821#M188951</guid>
      <dc:creator>mangar</dc:creator>
      <dc:date>2010-08-24T12:15:02Z</dc:date>
    </item>
  </channel>
</rss>

