Dropped PDF files appear as "plain" files.

Whenever I drop (native method) a PDF document on my new 5.5 Nuxeo DM, it is uploaded as “binary” (default icon). Hence Preview failing.

But when I import the same PDF file in the same space through the “Import file” feature, it appears with a nice PDF icon, preview works greats, and so on…

Question is : is this supposed to happen?

1 votes

2 answers

1267 views

ANSWER

No it's not, and it works all right for me. What platform are you on? Does your PDF have a proper .pdf extension?
12/14/2011

Yes they does. Is this supposed to work on file extension?

But at least, ODF files are working…

12/15/2011

Same here. No problem of this sort on the 2 clean instals I just did.
12/15/2011



Ok, here is a little summary on the problem, I'm about to find the solution.

  1. It's clearly on my side, and not on Nuxeo's.
  2. It has to do with my Firefox profile. Other profiles or other browsers don't have the problem.
  3. While it should send PDFs with the right MIME type, it sends them as application/force-download

Found a little bit of information about that kind of problem here : http://techblog.procurios.nl/k/news/view/15872/14863/Mimetype-corruption-in-Firefox.html

So I looked into my mimeTypes.rdf, and found this :

<RDF:Description RDF:about=“urn:mimetype:application/force-download”

               NC:fileExtensions="pdf"
               NC:description="Adobe Acrobat 7.0 Document"
               NC:value="application/force-download"
               NC:editable="true">
<NC:handlerProp RDF:resource="urn:mimetype:handler:application/force-download"/>

I'm not sure yet where it comes from, but I'm pretty sure deleting this RDF triple could to the trick. Testing it…

Edit: tested it ok, it works. If anyone stumbles onto the same problem, just delete the RDF triple linking your filetype to application/force-download in mimeTypes.rdf (in your FF profile), and you should be going.

1 votes



Did you install drag'n drop extension or did you use the HTML5 ones ?

If you download the file drag'n dropped, do you find your document ?

Can you add in your $TOMCAT/lib/log4j.xml after this:

<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="false" threshold="null">

with this following lines:

<appender name="TMP" class="org.apache.log4j.DailyRollingFileAppender">
  <errorHandler class="org.apache.log4j.helpers.OnlyOnceErrorHandler" />
  <param name="File" value="${nuxeo.log.dir}/tmp.log" />
  <param name="Append" value="true" />
  <!-- Rollover at midnight every day -->
  <param name="DatePattern" value="'.'yyyy-MM-dd" />
  <layout class="org.apache.log4j.PatternLayout">
    <param name="ConversionPattern" value="%d{ISO8601} %-5p [%c] %m%n" />
  </layout>
</appender>

<category name="org.nuxeo.ecm.platform.filemanager">
  <level>DEBUG</level>
  <appender-ref ref="TMP" />
</category>
  • restart your server
  • do the drag'n drop action
  • copy here the $Nuxeo/log/tmp.log content as comment here

We will try to see which file manager you are using.

1 votes



Thanks for your answer. First of all, I'm using the native way (HTML5, NOT the extension).

Then, the file is completely readable and complete and all. Just it isn't "tagged" with the good type.

Then I went the log way, and I got something like this :

2011-12-15 14:10:32,485 DEBUG [org.nuxeo.ecm.platform.filemanager.service.extension.DefaultFileImporter] imported the document: modele_certificat_urbans with icon: /icons/application.png and type: File

12/15/2011

When I import a PDF I get:

2011-12-15 16:36:57,057 DEBUG [org.nuxeo.ecm.platform.filemanager.service.extension.DefaultFileImporter] imported the document: JSR-168-portlet-1.0.pdf with icon: /icons/pdf.png and type: File

You can see the file extension there.

This means that in your case the file you're dropping does not have a .pdf extension and no MIME type was provided to the browser. You haven't told us what platform (Linux, Windows, Mac OS X) and browser you are using.

12/15/2011

Whoops, this is Win XP and FF 8.

But I have something weirder. The file I uploaded there was named modele_certificat_urbansime_information.pdf, so I don't quite get why it got trimmed. Here is the log for another file, named cledefa.pdf :

[org.nuxeo.ecm.platform.filemanager.service.extension.DefaultFileImporter] imported the document: cledefa.pdf.1323954608931 with icon: /icons/application.png and type: File

Where does all those numbers come from? I understand none of these files look like PDFs, for their filenames are either trimmed or padded. But why does this happen in the first place?

12/15/2011

Ok the truncation is not the issue. When I add a PDF with a long name I get for instance:

2011-12-15 16:55:46,292 DEBUG [org.nuxeo.ecm.platform.filemanager.service.extension.DefaultFileImporter] imported the document: JSR-291-OSGi-v4.1-draft- with icon: /icons/pdf.png and type: File

What's logged here is the internal document name (visible in the url). It's trimmed as we limit the size of the url component. The numbers appear when you already have a file in the Nuxeo folder with the same name (last url component).

12/15/2011

So apparently the MIME type passed during the drop is incorrect. Could you run a network trace with Wireshark here to find out what's sent by Firefox to Nuxeo? You should see a

POST /nuxeo/site/automation/batch/upload HTTP/1.1

with various headers, among them X-File-Type: application/pdf.

12/15/2011

I got :

X-File-Type:application/force-download

Just out of curiosity, I tried on Chrome and it works perfectly. I'm going to try on a "new" FF profile, just in case…

12/15/2011

It works on FF8 on Seven with a new profile. Not sure yet whether it's XP or the profile, but I'd say "the profile".
12/15/2011