Observed behavior:
- open WebUI and navigate to a folder
- drag'n'drop a css file called styles.css
- press Import
- check the document type, it will be Note, with "note:mime_type" property set to "text/plain"
NuxeoUI on batch upload correctly sets the content type to text/css, there're 2 headers set on the POST request: "Content-Type: text/css" and
"X-File-Type: text/css", but the follow up call to FileManager.Import seems to messes things up.
The same happens with a javascript file.
This can be reproduced with the javascript client calling the api:
const uploadFolder = '/';
const nuxeoBatch = nuxeo.batchUpload();
const fileContent = fs.readFileSync('styles.css');
const blob = new Nuxeo.Blob({
content: fileContent,
name: 'styles.css',
mimeType: 'text/css',
size: fileContent.length
});
nuxeoBatch.upload(blob);
nuxeoBatch.done().then((batch) => {
return nuxeo.request(`/upload/${nuxeoBatch._batchId}/execute/FileManager.Import`)
.post({ body: { context: { currentDocument: uploadFolder } } });
}).then((uploaded) => {
// uploaded[0].properties['file:content']['mime-type'] is not 'text/css' !
});
What's weird is that if I first upload a pdf file, which correctly gets "application/pdf" mime-type, and then replace the contents with styles.css, then the mime type will be correctly set (guess coz this doesn't involve FileManager.Import).