Merge pull request #1265 from joker-x/develop
Avoid use of os.tmpDir() for keep node 0.6 compatibility
This commit is contained in:
commit
0908caaf0d
1 changed files with 5 additions and 1 deletions
|
@ -34,6 +34,9 @@ var ERR = require("async-stacktrace")
|
||||||
if(settings.abiword != null)
|
if(settings.abiword != null)
|
||||||
var abiword = require("../utils/Abiword");
|
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
|
* do a requested import
|
||||||
*/
|
*/
|
||||||
|
@ -52,6 +55,7 @@ exports.doImport = function(req, res, padId)
|
||||||
function(callback) {
|
function(callback) {
|
||||||
var form = new formidable.IncomingForm();
|
var form = new formidable.IncomingForm();
|
||||||
form.keepExtensions = true;
|
form.keepExtensions = true;
|
||||||
|
form.uploadDir = tmpDirectory;
|
||||||
|
|
||||||
form.parse(req, function(err, fields, files) {
|
form.parse(req, function(err, fields, files) {
|
||||||
//the upload failed, stop at this point
|
//the upload failed, stop at this point
|
||||||
|
@ -91,7 +95,7 @@ exports.doImport = function(req, res, padId)
|
||||||
//convert file to html
|
//convert file to html
|
||||||
function(callback) {
|
function(callback) {
|
||||||
var randNum = Math.floor(Math.random()*0xFFFFFFFF);
|
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) {
|
if (abiword) {
|
||||||
abiword.convertFile(srcFile, destFile, "htm", function(err) {
|
abiword.convertFile(srcFile, destFile, "htm", function(err) {
|
||||||
|
|
Loading…
Reference in a new issue