diff --git a/src/node/handler/ImportHandler.js b/src/node/handler/ImportHandler.js
index 17b306595c1..3c85b4cc513 100644
--- a/src/node/handler/ImportHandler.js
+++ b/src/node/handler/ImportHandler.js
@@ -181,8 +181,15 @@ async function doImport(req, res, padId)
if (!req.directDatabaseAccess) {
text = await fsp_readFile(destFile, "utf8");
- // Title needs to be stripped out else it appends it to the pad..
- text = text.replace("
", "");
// node on windows has a delay on releasing of the file lock.
diff --git a/src/node/utils/LibreOffice.js b/src/node/utils/LibreOffice.js
index d72b9324920..267f7a0cd0a 100644
--- a/src/node/utils/LibreOffice.js
+++ b/src/node/utils/LibreOffice.js
@@ -38,6 +38,14 @@ var libreOfficeLogger = log4js.getLogger('LibreOffice');
* @param {Function} callback Standard callback function
*/
exports.convertFile = function(srcFile, destFile, type, callback) {
+ // Used for the moving of the file, not the conversion
+ var fileExtension = type;
+
+ if (type === "html") {
+ // "html:XHTML Writer File:UTF8" does a better job than normal html exports
+ type = "html:XHTML Writer File:UTF8";
+ }
+
// soffice can't convert from html to doc directly (verified with LO 5 and 6)
// we need to convert to odt first, then to doc
// to avoid `Error: no export filter for /tmp/xxxx.doc` error
@@ -47,11 +55,11 @@ exports.convertFile = function(srcFile, destFile, type, callback) {
"destFile": destFile.replace(/\.doc$/, '.odt'),
"type": 'odt',
"callback": function () {
- queue.push({"srcFile": srcFile.replace(/\.html$/, '.odt'), "destFile": destFile, "type": type, "callback": callback});
+ queue.push({"srcFile": srcFile.replace(/\.html$/, '.odt'), "destFile": destFile, "type": type, "callback": callback, "fileExtension": fileExtension });
}
});
} else {
- queue.push({"srcFile": srcFile, "destFile": destFile, "type": type, "callback": callback});
+ queue.push({"srcFile": srcFile, "destFile": destFile, "type": type, "callback": callback, "fileExtension": fileExtension});
}
};
@@ -102,7 +110,7 @@ function doConvertTask(task, callback) {
// Move the converted file to the correct place
function(callback) {
var filename = path.basename(task.srcFile);
- var sourceFilename = filename.substr(0, filename.lastIndexOf('.')) + '.' + task.type;
+ var sourceFilename = filename.substr(0, filename.lastIndexOf('.')) + '.' + task.fileExtension;
var sourcePath = path.join(tmpDir, sourceFilename);
libreOfficeLogger.debug(`Renaming ${sourcePath} to ${task.destFile}`);
fs.rename(sourcePath, task.destFile, callback);
diff --git a/src/static/js/contentcollector.js b/src/static/js/contentcollector.js
index d3bd7338340..038b235070a 100644
--- a/src/static/js/contentcollector.js
+++ b/src/static/js/contentcollector.js
@@ -526,6 +526,16 @@ function makeContentCollector(collectStyles, abrowser, apool, domInterface, clas
if (isPre) cc.incrementFlag(state, 'preMode');
var oldListTypeOrNull = null;
var oldAuthorOrNull = null;
+
+ // LibreOffice Writer puts in weird items during import or copy/paste, we should drop them.
+ if (cls === "Numbering_20_Symbols" || cls === "Bullet_20_Symbols") {
+ styl = null;
+ cls = null;
+
+ // We have to return here but this could break things in the future, for now it shows how to fix the problem
+ return;
+ }
+
if (collectStyles)
{
hooks.callAll('collectContentPre', {