summaryrefslogtreecommitdiff
path: root/src/node/handler/ImportHandler.js
diff options
context:
space:
mode:
authorJainendra Mandavi <jainendra16mandavi@gmail.com>2017-07-28 18:28:23 +0530
committerJainendra Mandavi <jainendra16mandavi@gmail.com>2017-07-28 23:13:07 +0530
commite4ddb42e11d9026199be4fcc37360082a48bee1c (patch)
tree2b0b1c2735a7fd7a0e711f995a7b157b29c0359d /src/node/handler/ImportHandler.js
parentf9203524a4db9de58e8d37eca424a9efbdb6ac1b (diff)
downloadetherpad-lite-e4ddb42e11d9026199be4fcc37360082a48bee1c.zip
FIX-2864: Add useAbiword flag
This is a fix for the issue - 2864 Which is import failure of PDF after importing a text file
Diffstat (limited to 'src/node/handler/ImportHandler.js')
-rw-r--r--src/node/handler/ImportHandler.js14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/node/handler/ImportHandler.js b/src/node/handler/ImportHandler.js
index 870c954a..6aa94e64 100644
--- a/src/node/handler/ImportHandler.js
+++ b/src/node/handler/ImportHandler.js
@@ -56,10 +56,14 @@ exports.doImport = function(req, res, padId)
, pad
, text
, importHandledByPlugin
- , directDatabaseAccess;
+ , directDatabaseAccess
+ , useAbiword;
var randNum = Math.floor(Math.random()*0xFFFFFFFF);
+ // setting flag for whether to use abiword or not
+ useAbiword = (abiword != null);
+
async.series([
//save the uploaded file to /tmp
function(callback) {
@@ -147,9 +151,9 @@ exports.doImport = function(req, res, padId)
var fileEnding = path.extname(srcFile).toLowerCase();
var fileIsHTML = (fileEnding === ".html" || fileEnding === ".htm");
var fileIsTXT = (fileEnding === ".txt");
- if (fileIsTXT) abiword = false; // Don't use abiword for text files
+ if (fileIsTXT) useAbiword = false; // Don't use abiword for text files
// See https://github.com/ether/etherpad-lite/issues/2572
- if (abiword && !fileIsHTML) {
+ if (useAbiword && !fileIsHTML) {
abiword.convertFile(srcFile, destFile, "htm", function(err) {
//catch convert errors
if(err) {
@@ -169,7 +173,7 @@ exports.doImport = function(req, res, padId)
},
function(callback) {
- if (!abiword && !directDatabaseAccess){
+ if (!useAbiword && !directDatabaseAccess){
// Read the file with no encoding for raw buffer access.
fs.readFile(destFile, function(err, buf) {
if (err) throw err;
@@ -228,7 +232,7 @@ exports.doImport = function(req, res, padId)
function(callback) {
if(!directDatabaseAccess){
var fileEnding = path.extname(srcFile).toLowerCase();
- if (importHandledByPlugin || abiword || fileEnding == ".htm" || fileEnding == ".html") {
+ if (importHandledByPlugin || useAbiword || fileEnding == ".htm" || fileEnding == ".html") {
importHtml.setPadHTML(pad, text, function(e){
if(e) apiLogger.warn("Error importing, possibly caused by malformed HTML");
});