-
Notifications
You must be signed in to change notification settings - Fork 45
[APS-22106] replace decompress@4.2.1 with adm-zip@0.6.1 #1184
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -11,7 +11,7 @@ const logger = require('./logger').winstonLogger, | |||||
| const { default: axios } = require('axios'); | ||||||
| const { HttpsProxyAgent = require('https-proxy-agent') } = require('https-proxy-agent'); | ||||||
| const FormData = require('form-data'); | ||||||
| const decompress = require('decompress'); | ||||||
| const AdmZip = require('adm-zip'); | ||||||
| const unzipper = require("unzipper"); | ||||||
| const { setAxiosProxy } = require('./helper'); | ||||||
|
|
||||||
|
|
@@ -154,10 +154,11 @@ const downloadAndUnzip = async (filePath, fileName, url) => { | |||||
| const unzipFile = async (filePath, fileName) => { | ||||||
| return new Promise( async (resolve, reject) => { | ||||||
| try { | ||||||
| await decompress(path.join(filePath, fileName), filePath); | ||||||
| const zip = new AdmZip(path.join(filePath, fileName)); | ||||||
|
avinash-bharti marked this conversation as resolved.
Dismissed
|
||||||
| await zip.extractAllToAsync(filePath, /* overwrite */ true); | ||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [Low] Entry permission bits are no longer preserved
Almost certainly irrelevant for videos, logs, screenshots and HTML reports, but it is a real behaviour change that falls out of the swap incidentally rather than deliberately. Suggestion: Either confirm nothing in these archives needs its mode bits preserved, or pass it explicitly:
Suggested change
Reviewer: stack:code-review |
||||||
| resolve(); | ||||||
| } catch (error) { | ||||||
| logger.debug(`Error unzipping with decompress, trying with unzipper. Stacktrace: ${error}.`); | ||||||
| logger.debug(`Error unzipping with adm-zip, trying with unzipper. Stacktrace: ${error}.`); | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win 🔎 Supported by static analysis🏁 Script executed: git diff 4a6768e38195b5ecdd609320a42bd8da4adf3d30 adc6c2b57212db080ec962d2b0af0f4b7d569161 -- bin/helpers/buildArtifacts.js bin/helpers/reporterHTML.js
sed -n '140,178p' bin/helpers/buildArtifacts.js
sed -n '165,196p' bin/helpers/reporterHTML.js
rg -n 'logger.debug|function unzipFile|unzipFile\(' bin/helpers/buildArtifacts.js bin/helpers/reporterHTML.js bin/helpers/logger.jsRepository: browserstack/browserstack-cypress-cli Length of output: 5948 Apply the Constants rule only to the new build fallback message. The The 🧰 Tools🪛 Biome (2.5.11)[error] 155-176: Promise executor functions should not be (lint/suspicious/noAsyncPromiseExecutor) 🤖 Prompt for AI Agents
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [Low] Inline string vs the CodeRabbit flagged this line against the repo rule that strings live in So: valid under a strict reading, mischaracterized as new, and Trivial either way. Not a regression introduced by this PR. Suggestion: Optional. Moving it into Reviewer: CodeRabbit (confirmed) |
||||||
| try { | ||||||
| fs.createReadStream(path.join(filePath, fileName)) | ||||||
| .pipe(unzipper.Extract({ path: filePath })) | ||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,7 +6,7 @@ const fs = require('fs'), | |
| utils = require("./utils"), | ||
| Constants = require('./constants'), | ||
| config = require("./config"), | ||
| decompress = require('decompress'); | ||
| AdmZip = require('adm-zip'); | ||
| const { isTurboScaleSession } = require('../helpers/atsHelper'); | ||
|
|
||
| const { setAxiosProxy } = require('./helper'); | ||
|
|
@@ -171,15 +171,14 @@ function getReportResponse(filePath, fileName, reportJsonUrl) { | |
|
|
||
| const unzipFile = async (filePath, fileName) => { | ||
| return new Promise( async (resolve, reject) => { | ||
| await decompress(path.join(filePath, fileName), filePath) | ||
| .then((files) => { | ||
| let message = "Unzipped the json and html successfully." | ||
| resolve(message); | ||
| }) | ||
| .catch((error) => { | ||
| try { | ||
| const zip = new AdmZip(path.join(filePath, fileName)); | ||
|
avinash-bharti marked this conversation as resolved.
Dismissed
avinash-bharti marked this conversation as resolved.
Dismissed
|
||
| await zip.extractAllToAsync(filePath, /* overwrite */ true); | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [Medium] No
That matters a little more after this change, because The asymmetry pre-dates this PR (decompress had no fallback here either), so this is a verify-and-dismiss item rather than a defect — Suggestion: Confirm during smoke-testing that a real Reviewer: stack:code-review |
||
| resolve("Unzipped the json and html successfully."); | ||
| } catch (error) { | ||
| reject(error); | ||
| process.exitCode = Constants.ERROR_EXIT_CODE; | ||
| }); | ||
| } | ||
| }); | ||
| } | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.