diff options
author | Iván Eixarch <miao.org@gmail.com> | 2012-12-06 11:49:04 +0100 |
---|---|---|
committer | Iván Eixarch <miao.org@gmail.com> | 2012-12-06 11:49:04 +0100 |
commit | bf04a4686a3df9b38788646b6677a8e699454bb8 (patch) | |
tree | 18c0bbc34f22162bf6531e1844ccd09cc8633777 /src | |
parent | f9b6d9f1228930fcadc95401e6330efb7af387f0 (diff) | |
download | etherpad-lite-bf04a4686a3df9b38788646b6677a8e699454bb8.zip |
avoid use of os.tmpDir() for node 0.6 compatibility
Diffstat (limited to 'src')
-rw-r--r-- | src/node/handler/ImportHandler.js | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/node/handler/ImportHandler.js b/src/node/handler/ImportHandler.js index 815e5357..6bf223f2 100644 --- a/src/node/handler/ImportHandler.js +++ b/src/node/handler/ImportHandler.js @@ -33,6 +33,9 @@ var ERR = require("async-stacktrace") //load abiword only if its enabled if(settings.abiword != null) var abiword = require("../utils/Abiword"); + +//for node 0.6 compatibily, os.tmpDir() only works from 0.8 +var tmpDirectory = process.env.TEMP || process.env.TMPDIR || process.env.TMP || '/tmp'; /** * do a requested import @@ -52,6 +55,7 @@ exports.doImport = function(req, res, padId) function(callback) { var form = new formidable.IncomingForm(); form.keepExtensions = true; + form.uploadDir = tmpDirectory; form.parse(req, function(err, fields, files) { //the upload failed, stop at this point @@ -91,7 +95,7 @@ exports.doImport = function(req, res, padId) //convert file to html function(callback) { var randNum = Math.floor(Math.random()*0xFFFFFFFF); - destFile = path.join(os.tmpDir(), "eplite_import_" + randNum + ".htm"); + destFile = path.join(tmpDirectory, "eplite_import_" + randNum + ".htm"); if (abiword) { abiword.convertFile(srcFile, destFile, "htm", function(err) { |