From b0976a292f70c2c6d344bafd2793aed09027f74b Mon Sep 17 00:00:00 2001 From: jaseg Date: Thu, 10 Nov 2011 11:37:12 +0100 Subject: [PATCH] Fixed a somewhat quirky random string generator, made another windows-only delay actually windows-only. --- node/handler/ImportHandler.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/node/handler/ImportHandler.js b/node/handler/ImportHandler.js index a1ddf992..ec520a47 100644 --- a/node/handler/ImportHandler.js +++ b/node/handler/ImportHandler.js @@ -112,7 +112,7 @@ exports.doImport = function(req, res, padId) //convert file to text function(callback) { - var randNum = Math.floor(Math.random()*new Date().getTime()); + var randNum = Math.floor(Math.random()*0xFFFFFFFF); destFile = tempDirectory + "eplite_import_" + randNum + ".txt"; abiword.convertFile(srcFile, destFile, "txt", callback); }, @@ -136,10 +136,13 @@ exports.doImport = function(req, res, padId) //node on windows has a delay on releasing of the file lock. //We add a 100ms delay to work around this - setTimeout(function() - { - callback(err); - }, 100); + if(os.type().indexOf("Windows") > -1) + { + setTimeout(function() + { + callback(err); + }, 100); + } }); },