summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn McLear <john@mclear.co.uk>2014-05-07 16:27:41 +0100
committerJohn McLear <john@mclear.co.uk>2014-05-07 16:27:41 +0100
commitec6dc4fa0ee785c7d80420ef706af7b87dab3218 (patch)
tree054e8a83f43c9614a155ec5dc6971b5787cb7360
parent69ba3cc104e919ef51bc619e3b8a1630b3f11616 (diff)
downloadetherpad-lite-ec6dc4fa0ee785c7d80420ef706af7b87dab3218.zip
make async, please check
-rw-r--r--src/node/handler/ExportHandler.js11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/node/handler/ExportHandler.js b/src/node/handler/ExportHandler.js
index b3b6f756..54b41c46 100644
--- a/src/node/handler/ExportHandler.js
+++ b/src/node/handler/ExportHandler.js
@@ -46,10 +46,15 @@ if(os.type().indexOf("Windows") > -1)
*/
exports.doExport = function(req, res, padId, type)
{
+ var fileName = padId;
+
// allow fileName to be overwritten by a hook, the type type is kept static for security reasons
- var fileName = hooks.callAll("exportFileName", padId);
- // if fileName is not set then set it to the padId, note that fileName is returned as an array.
- if(!fileName[0]) fileName = padId;
+ hooks.aCallAll("exportFileName", padId,
+ function(err, hookFileName){
+ // if fileName is set then set it to the padId, note that fileName is returned as an array.
+ if(fileName[0]) fileName = hookFileName;
+ }
+ );
//tell the browser that this is a downloadable file
res.attachment(fileName + "." + type);