mirror of
https://github.com/Llewellynvdm/nativefier.git
synced 2025-01-10 17:24:39 +00:00
- Appname that contains unsafe characters which will cause electron packager to hang, so we sanitize them before passing them to electron-packager
This commit is contained in:
parent
56b7abacf8
commit
03440e9227
@ -43,6 +43,7 @@
|
||||
"lodash": "^4.0.0",
|
||||
"ncp": "^2.0.0",
|
||||
"request": "^2.67.0",
|
||||
"sanitize-filename": "^1.5.3",
|
||||
"source-map-support": "^0.4.0",
|
||||
"tmp": "0.0.28",
|
||||
"validator": "^4.5.0"
|
||||
|
@ -5,6 +5,7 @@ import url from 'url';
|
||||
import request from 'request';
|
||||
import cheerio from 'cheerio';
|
||||
import validator from 'validator';
|
||||
import sanitize from 'sanitize-filename';
|
||||
|
||||
const TEMPLATE_APP_DIR = path.join(__dirname, '../', 'app');
|
||||
const ELECTRON_VERSION = '0.36.4';
|
||||
@ -69,7 +70,7 @@ function optionsFactory(name,
|
||||
|
||||
if (name && name.length > 0) {
|
||||
options.name = name;
|
||||
callback(null, options);
|
||||
callback(null, sanitizeOptions(options));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -81,10 +82,15 @@ function optionsFactory(name,
|
||||
options.name = pageTitle;
|
||||
}
|
||||
|
||||
callback(null, options);
|
||||
callback(null, sanitizeOptions(options));
|
||||
});
|
||||
}
|
||||
|
||||
function sanitizeOptions(options) {
|
||||
options.name = sanitize(options.name);
|
||||
return options;
|
||||
}
|
||||
|
||||
function detectPlatform() {
|
||||
const platform = os.platform();
|
||||
if (platform === 'darwin' || platform === 'win32' || platform === 'linux') {
|
||||
|
Loading…
Reference in New Issue
Block a user