mirror of
https://github.com/appium/appium.git
synced 2026-02-12 21:10:10 -06:00
Use correct suffix (.zip or .apk) when downloading app from a url.
md5calculator (used in lib/devices/android/android-common.js) can only handle files that end in .ipa or .apk, not .zip. Currently urls that end in .apk are downloaded as appium-app.zip
This commit is contained in:
@@ -296,7 +296,7 @@ Appium.prototype.configureDownloadedApp = function(appPath, origin, cb) {
|
||||
var appUrl = appPath;
|
||||
if (appUrl.substring(appUrl.length - 4) === ".apk") {
|
||||
try {
|
||||
downloadFile(appUrl, function(appPath) {
|
||||
downloadFile(appUrl, ".apk", function(appPath) {
|
||||
this.tempFiles.push(appPath);
|
||||
this.args.app = appPath;
|
||||
cb(null);
|
||||
@@ -406,7 +406,7 @@ Appium.prototype.configureChromeAndroid = function(appPath) {
|
||||
};
|
||||
|
||||
Appium.prototype.downloadAndUnzipApp = function(appUrl, cb) {
|
||||
downloadFile(appUrl, function(zipPath) {
|
||||
downloadFile(appUrl, ".zip", function(zipPath) {
|
||||
this.unzipApp(zipPath, cb);
|
||||
}.bind(this));
|
||||
};
|
||||
|
||||
@@ -15,10 +15,10 @@ var logger = require('./server/logger.js').get('appium')
|
||||
, AdmZip = require('adm-zip');
|
||||
|
||||
|
||||
exports.downloadFile = function(fileUrl, cb) {
|
||||
exports.downloadFile = function(fileUrl, suffix, cb) {
|
||||
// We will be downloading the files to a directory, so make sure it's there
|
||||
// This step is not required if you have manually created the directory
|
||||
tempdir.open({prefix: 'appium-app', suffix: '.zip'}, function(err, info) {
|
||||
tempdir.open({prefix: 'appium-app', suffix: suffix}, function(err, info) {
|
||||
var file = fs.createWriteStream(info.path);
|
||||
request(fileUrl).pipe(file).on('close', function() {
|
||||
logger.info(fileUrl + ' downloaded to ' + info.path);
|
||||
|
||||
Reference in New Issue
Block a user