Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Random filename generation fix, made a windows-only delay actually windows-only. #242

Merged
merged 1 commit into from
Nov 26, 2011
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions node/handler/ImportHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
},
Expand All @@ -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)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

my fault that I didn't look closer on it. But you broke the import here. Now it calls the callback only on windows

{
setTimeout(function()
{
callback(err);
}, 100);
}
});
},

Expand Down