summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorStefan <stefan@stefans-entwicklerecke.de>2017-07-30 11:42:39 +0200
committerGitHub <noreply@github.com>2017-07-30 11:42:39 +0200
commit5382b06ede7cd27c97df669e06379c7547a898e9 (patch)
tree104f481519fcf74376ac91347e57f2195a2e2dd2 /src
parent59ba183c82eb3bbbe2da12df2d562c44f6798711 (diff)
parente4ddb42e11d9026199be4fcc37360082a48bee1c (diff)
downloadetherpad-lite-5382b06ede7cd27c97df669e06379c7547a898e9.zip
Merge pull request #3231 from jainendra/fix-2864-import-pdf
FIX-2864: Add useAbiword flag
Diffstat (limited to 'src')
-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");
});