Skip to content

Commit c55700d

Browse files
committed
[js] Do not compress zip entries.
This causes errors on decompression if the zip contains a file that was already compressed (such as a jar). Fixes #640
1 parent b770835 commit c55700d

File tree

4 files changed

+7
-1
lines changed

4 files changed

+7
-1
lines changed

javascript/node/selenium-webdriver/CHANGES.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
## v2.48.0-dev
22

3+
* FIXED: zip files created for transfer to a remote WebDriver server are no
4+
longer compressed. If the zip contained a file that was already compressed,
5+
the server would return an "invalid code lengths set" error.
36
* FIXED: Surfaced the `loopback` option to `remote/SeleniumServer`. When set,
47
the server will be accessed using the current host's loopback address.
58

javascript/node/selenium-webdriver/firefox/extension.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@ function install(extension, dir) {
6969
return io.copy(extension, dst + '.xpi').then(returnId);
7070
} else {
7171
return checkedCall(fs.readFile, extension).then(function(buff) {
72-
var zip = new AdmZip(buff);
7372
// TODO: find an async library for inflating a zip archive.
7473
new AdmZip(buff).extractAllTo(dst, true);
7574
}).then(returnId);

javascript/node/selenium-webdriver/firefox/profile.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
'use strict';
2424

2525
var AdmZip = require('adm-zip'),
26+
AdmConstants = require('adm-zip/util/constants'),
2627
fs = require('fs'),
2728
path = require('path'),
2829
util = require('util'),
@@ -403,6 +404,7 @@ Profile.prototype.encode = function() {
403404
return this.writeToDisk(true).then(function(dir) {
404405
var zip = new AdmZip();
405406
zip.addLocalFolder(dir, '');
407+
zip.getEntries()[0].header.method = AdmConstants.STORED;
406408
return io.tmpFile().then(function(file) {
407409
zip.writeZip(file); // Sync! Why oh why :-(
408410
return promise.checkedNodeCall(fs.readFile, file);

javascript/node/selenium-webdriver/remote/index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
'use strict';
1919

2020
var AdmZip = require('adm-zip'),
21+
AdmConstants = require('adm-zip/util/constants'),
2122
fs = require('fs'),
2223
path = require('path'),
2324
url = require('url'),
@@ -351,6 +352,7 @@ FileDetector.prototype.handleFile = function(driver, filePath) {
351352

352353
var zip = new AdmZip();
353354
zip.addLocalFile(filePath);
355+
zip.getEntries()[0].header.method = AdmConstants.STORED;
354356

355357
var command = new webdriver.Command(webdriver.CommandName.UPLOAD_FILE)
356358
.setParameter('file', zip.toBuffer().toString('base64'));

0 commit comments

Comments
 (0)