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?
Ok, here is a little summary on the problem, I'm about to find the solution.
- It's clearly on my side, and not on Nuxeo's.
- It has to do with my Firefox profile. Other profiles or other browsers don't have the problem.
- 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.
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.
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
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.
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?
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).
POST /nuxeo/site/automation/batch/upload HTTP/1.1
with various headers, among them X-File-Type: application/pdf
.
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…
.pdf
extension?But at least, ODF files are working…