From bfde869948ecd7a40f99467831caaa22877d3dec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Olivier=20T=C3=A9tard?= Date: Sun, 28 Sep 2014 14:53:07 +0200 Subject: [PATCH] =?UTF-8?q?If=20exportFileName=20hook=20isn=E2=80=99t=20de?= =?UTF-8?q?fined=20don=E2=80=99t=20return=20empty=20filename.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This commit should fix #2251. If ``exportFileName`` hook is not defined, ``hookFileName`` should be an empty array. Test the length of ``hookFileName`` before overriding ``fileName``, the export filename. --- src/node/handler/ExportHandler.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/node/handler/ExportHandler.js b/src/node/handler/ExportHandler.js index a748d3f2e..5bedcce22 100644 --- a/src/node/handler/ExportHandler.js +++ b/src/node/handler/ExportHandler.js @@ -52,7 +52,7 @@ exports.doExport = function(req, res, padId, type) hooks.aCallFirst("exportFileName", padId, function(err, hookFileName){ // if fileName is set then set it to the padId, note that fileName is returned as an array. - if(hookFileName) fileName = hookFileName; + if(hookFileName.length) fileName = hookFileName; //tell the browser that this is a downloadable file