cleaning app opt at the beginning

This commit is contained in:
sebv
2015-09-01 01:59:24 +08:00
parent 170dff3a77
commit df5a82609c
2 changed files with 9 additions and 1 deletions
+6
View File
@@ -20,6 +20,12 @@ commands.createSession = async function (caps) {
// merge caps onto opts so we don't need to worry about what's where
Object.assign(this.opts, this.caps);
// Prevents empty string caps so we don't need to test it everywhere
if (typeof this.opts.app === 'string' && this.opts.app.trim() === '') {
this.opts.app = null;
}
if (!_.isUndefined(this.caps.newCommandTimeout)) {
this.newCommandTimeoutMs = (this.caps.newCommandTimeout * 1000);
}
+3 -1
View File
@@ -12,9 +12,11 @@ import request from 'request';
const ZIP_EXTS = ['.zip', '.ipa'];
async function configureApp (app, appExt) {
if (_.isNull(app) || _.isUndefined(app)) { return; }
let newApp = null;
let shouldUnzipApp = _.contains(ZIP_EXTS, path.extname(app));
if (app.substring(0, 4).toLowerCase() === "http") {
if ((app || '').substring(0, 4).toLowerCase() === "http") {
logger.info(`Using downloadable app ${app}`);
newApp = await downloadApp(app, shouldUnzipApp ? ".zip" : appExt);
logger.info(`Downloaded app to ${newApp}`);