fix: Enforce encoding on extracted file names for .ipa archives
MODIFY
lib/basedriver/helpers.js
lib/basedriver/helpers.js
@@ -2,13 +2,14 @@ import _ from 'lodash';
import path from 'path';
import url from 'url';
import logger from './logger';
-import { tempDir, fs, util, zip, net } from 'appium-support';
+import { tempDir, fs, util, zip, net, timing } from 'appium-support';
import LRU from 'lru-cache';
import AsyncLock from 'async-lock';
import axios from 'axios';
-const ZIP_EXTS = ['.zip', '.ipa'];
+const IPA_EXT = '.ipa';
+const ZIP_EXTS = ['.zip', IPA_EXT];
const ZIP_MIME_TYPES = [
'application/zip',
'application/x-zip-compressed',
@@ -321,9 +322,18 @@ async function unzipApp (zipPath, dstRoot, supportedAppExtensions) {
const tmpRoot = await tempDir.openDir();
try {
logger.debug(`Unzipping '${zipPath}'`);
- await zip.extractAllTo(zipPath, tmpRoot);
+ const timer = new timing.Timer().start();
+ const extractionOpts = {};
+ // https://github.com/appium/appium/issues/14100
+ if (path.extname(zipPath) === IPA_EXT) {
+ logger.debug(`Enforcing UTF-8 encoding on the extracted file names for '${path.basename(zipPath)}'`);
+ extractionOpts.fileNamesEncoding = 'utf8';
+ }
+ await zip.extractAllTo(zipPath, tmpRoot, extractionOpts);
+ const duration = timer.getDuration();
const allExtractedItems = await fs.glob('**', {cwd: tmpRoot});
- logger.debug(`Extracted ${util.pluralize('item', allExtractedItems.length, true)} from '${zipPath}'`);
+ logger.debug(`Extracted ${util.pluralize('item', allExtractedItems.length, true)} ` +
+ `from '${zipPath}' in ${Math.round(duration.asMilliSeconds)}ms`);
const allBundleItems = allExtractedItems
.filter((relativePath) => supportedAppExtensions.includes(path.extname(relativePath)))
// Get the top level match

MODIFY
package.json
package.json
],
"dependencies": {
"@babel/runtime": "^7.0.0",
- "appium-support": "^2.46.0",
+ "appium-support": "^2.48.0",
"async-lock": "^1.0.0",
"asyncbox": "^2.3.1",
"axios": "^0.19.2",

fix: Enforce UTF-8 encoding on extracted file names for .ipa archives (#419)