<?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: Some imported files have &amp;apos;.txt&amp;apos; automatically appended to their name in Nuxeo Forum</title>
    <link>https://connect.hyland.com/t5/nuxeo-forum/some-imported-files-have-apos-txt-apos-automatically-appended-to/m-p/318922#M5923</link>
    <description>&lt;P&gt;Same problem occurs with FreeMind files except the .mm file replaced by .mm.txt file.&lt;/P&gt;</description>
    <pubDate>Tue, 02 Jun 2015 09:15:12 GMT</pubDate>
    <dc:creator>pibou_Bouvret</dc:creator>
    <dc:date>2015-06-02T09:15:12Z</dc:date>
    <item>
      <title>Some imported files have &amp;apos;.txt&amp;apos; automatically appended to their name</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/some-imported-files-have-apos-txt-apos-automatically-appended-to/m-p/318920#M5921</link>
      <description>&lt;P&gt;I've also tried this with a regular file import and it has the same behaviour. But, I first noticed it while using Nuxeo Drive (v1.2.1 on OSX 10.9).&lt;/P&gt;
&lt;P&gt;When I added some files to a synchronised folder on my local disk, they soon reappear duplicated by a file with the same name and &lt;CODE&gt;.txt&lt;/CODE&gt; appended to it. For instance, if I add a file named &lt;CODE&gt;myfile.properties&lt;/CODE&gt; to the folder, it synchronises with the platform, where I see it as &lt;CODE&gt;myfile.properties&lt;/CODE&gt;, but on the drive folder a &lt;STRONG&gt;new&lt;/STRONG&gt; &lt;CODE&gt;myfile.properties.txt&lt;/CODE&gt; emerges. If I delete the &lt;CODE&gt;myfile.properties.txt&lt;/CODE&gt; from the disk, &lt;STRONG&gt;both files&lt;/STRONG&gt; are removed by the synchronisation.&lt;/P&gt;
&lt;P&gt;Looking at the file metadata in the platform, I notice that it has a &lt;STRONG&gt;Title&lt;/STRONG&gt; of &lt;CODE&gt;myfile.properties&lt;/CODE&gt; and a &lt;STRONG&gt;Content&lt;/STRONG&gt; of &lt;CODE&gt;myfile.properties.txt&lt;/CODE&gt;.&lt;/P&gt;
&lt;P&gt;This is happening with more that one file extension: &lt;CODE&gt;*.properties&lt;/CODE&gt;, &lt;CODE&gt;*.log&lt;/CODE&gt;, &lt;CODE&gt;*.cnf&lt;/CODE&gt;, &lt;CODE&gt;*.diff&lt;/CODE&gt;, &lt;CODE&gt;*.list&lt;/CODE&gt;, &lt;EM&gt;etc&lt;/EM&gt;.&lt;/P&gt;
&lt;P&gt;Is there a MIME setting that can be configured to stop the &lt;CODE&gt;.txt&lt;/CODE&gt; extension from being appended to the file name?&lt;/P&gt;
&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Fri, 07 Feb 2014 00:13:17 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/some-imported-files-have-apos-txt-apos-automatically-appended-to/m-p/318920#M5921</guid>
      <dc:creator>Antonio_Abreu</dc:creator>
      <dc:date>2014-02-07T00:13:17Z</dc:date>
    </item>
    <item>
      <title>Re: Some imported files have &amp;apos;.txt&amp;apos; automatically appended to their name</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/some-imported-files-have-apos-txt-apos-automatically-appended-to/m-p/318921#M5922</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;I cannot really reproduce your use case, what I can reproduce is importing a &lt;CODE&gt;test.properties&lt;/CODE&gt; file to the server via the "Import a file" button and synchronize its parent folder which creates a &lt;CODE&gt;test.properties.txt&lt;/CODE&gt; file in the local folder. Your case is probably related to this behaviour and I will explain the reason.&lt;/P&gt;
&lt;P&gt;When importing a file to Nuxeo through Drag and Drop, or the "Import a file" button or Nuxeo Drive (let's say &lt;CODE&gt;test.properties&lt;/CODE&gt;), Nuxeo will create a document with a type depending on the file's mime-type. If it is text/plain, which is usually the case for the file extensions you're mentioning (*.properties, *.log, ...) a Note document is created.&lt;/P&gt;
&lt;P&gt;When looking at such a Note document, indeed its tile is the original filename: &lt;CODE&gt;test.properties&lt;/CODE&gt;, but in the "Main File" field of the Content section in the Summary tab you will see &lt;CODE&gt;test.properties.txt&lt;/CODE&gt;. This "filename" is in fact not stored anywhere, but only generated on the fly for display. This makes sense as a Note document, contrary to a File document,  only has a &lt;CODE&gt;note:note&lt;/CODE&gt; field to store the text content, and uses the &lt;CODE&gt;dc:title&lt;/CODE&gt; for its title, but no "filename" field as it is not a real file. Though it is &lt;EM&gt;seen&lt;/EM&gt; as a file using what we call the &lt;CODE&gt;BlobHolder&lt;/CODE&gt; interface, which allows to adapt the document to such a &lt;CODE&gt;BlobHolder&lt;/CODE&gt; object and call &lt;CODE&gt;#getBlob()&lt;/CODE&gt; to get a file containing the text content, which is actually downloadable from the Web UI and will be named &lt;CODE&gt;test.properties.txt&lt;/CODE&gt;. This file name is generated from the document's title suffixed by &lt;CODE&gt;.txt&lt;/CODE&gt;. And Nuxeo Drive uses this mechanism when downloading the file generated from a Note document, that's why you get the &lt;CODE&gt;*.txt&lt;/CODE&gt; files in the local folder...&lt;/P&gt;
&lt;P&gt;This Blob adaptation behaviour is handled by the &lt;CODE&gt;BlobHolderAdapterComponent&lt;/CODE&gt; which creates a &lt;CODE&gt;DocumentStringBlobHolder&lt;/CODE&gt; for Note documents. You can contribute a &lt;CODE&gt;BlobHolderFactory&lt;/CODE&gt; to this service to implement a different behaviour for Note documents, as in fact its default logic is quite poor: it avoids appending &lt;CODE&gt;.txt&lt;/CODE&gt; to a file already named &lt;CODE&gt;xxx.txt&lt;/CODE&gt; but doesn't take into accoutn other extensions:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;   String ext = ".txt";
   ...
   if (!title.endsWith(ext)) {
       title = title.concat(ext);
    }
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;You can also contribute to the &lt;CODE&gt;plugins&lt;/CODE&gt; extension point of the &lt;CODE&gt;FileManagerService&lt;/CODE&gt; service to define another importer than &lt;CODE&gt;NoteImporter&lt;/CODE&gt; for text documents, for example using the &lt;CODE&gt;DefaultFileImporter&lt;/CODE&gt; creating File documents, which should solve your issue.&lt;/P&gt;
&lt;P&gt;So no simple solution here and Java code might be needed.&lt;/P&gt;
&lt;P&gt;Hope this helps.&lt;/P&gt;</description>
      <pubDate>Fri, 07 Feb 2014 18:43:58 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/some-imported-files-have-apos-txt-apos-automatically-appended-to/m-p/318921#M5922</guid>
      <dc:creator>ataillefer_</dc:creator>
      <dc:date>2014-02-07T18:43:58Z</dc:date>
    </item>
    <item>
      <title>Re: Some imported files have &amp;apos;.txt&amp;apos; automatically appended to their name</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/some-imported-files-have-apos-txt-apos-automatically-appended-to/m-p/318922#M5923</link>
      <description>&lt;P&gt;Same problem occurs with FreeMind files except the .mm file replaced by .mm.txt file.&lt;/P&gt;</description>
      <pubDate>Tue, 02 Jun 2015 09:15:12 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/some-imported-files-have-apos-txt-apos-automatically-appended-to/m-p/318922#M5923</guid>
      <dc:creator>pibou_Bouvret</dc:creator>
      <dc:date>2015-06-02T09:15:12Z</dc:date>
    </item>
  </channel>
</rss>

