From 4e64af0f10f53f0dfbf730f36f62ce0ddc85a86c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABl=20M=C3=A9tais?= Date: Thu, 20 Nov 2014 14:53:50 +0100 Subject: [PATCH] Add quotes to User-Agent when console.logging the phantomas command line --- app/lib/phantomasWrapper.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/lib/phantomasWrapper.js b/app/lib/phantomasWrapper.js index cadb516..39a099c 100644 --- a/app/lib/phantomasWrapper.js +++ b/app/lib/phantomasWrapper.js @@ -50,7 +50,13 @@ var PhantomasWrapper = function() { console.log('If you want to reproduce the phantomas task only, copy the following command line:'); var optionsString = ''; for (var opt in options) { - optionsString += ' ' + '--' + opt + '=' + options[opt]; + + var value = options[opt]; + if ((typeof value === 'string' || value instanceof String) && value.indexOf(' ') >= 0) { + value = '"' + value + '"'; + } + + optionsString += ' ' + '--' + opt + '=' + value; } console.log('node node_modules/phantomas/bin/phantomas.js --url=' + task.url + optionsString + ' --verbose');