robinraju / release-downloader

Github action to download release assets from private or public repositories

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

1.9 version seems to have broken the extract functionality

kamimanzoor opened this issue · comments

Describe the bug
The extract option in 1.9 version seems to be broken. I have a release zip artifact which contains contents as:
artifact.zip
|__ conf (directory)
|__ dags (directory)
|__ requirements.txt (file)

When 1.9 version does extraction, it somehow extracts only as:
artifact.zip
|__ dags (directory)

missing both the conf and requirements.txt.

1.8 version seemed to work and extract fine. I came to know when my deployment pipeline started to fail after bumping the download action to 1.9. Now reverted it back to 1.8 and works fine.

To Reproduce
Steps to reproduce the behavior:

  1. Create a release zip artifact as mentioned above containing a couple of directories and a file
  2. Use the action with extract option
  3. Check the contents of extracted output

Expected behavior
the extraction in 1.9 version should behave the same as 1.8 i.e., the zip extraction should extract the contents correctly

Action Environment (please complete the following information):

  • OS: ubuntu-latest

I have a similar experience. Our CI workflow fails when upgrading to version 1.9.
We download a .zip with just one file and extract it. But somehow it appears that the extracted file does not have the correct content. I have not investigated further than this.

Can concur, from two repositories the correct contents are downloaded but from one repository, the file gets garbled and has a bad header.

Reverting to 1.8 in the problematic workflow.

Same problem for my project, thanks @seiry four your finding and help!! Reverting to 1.8 "solved" the download problem

Got the same problem - we use this to extract 7 text file in a zip, 2 of the 7 extracted files had its first 16384 bytes shifted to the end of the file. this only happens when the file is longer than 16384 bytes so smaller files are not affected.

Looks to be issue with unzipper library and it happens under node 18 and 20, and can be reproduced with the following code

const path = require("path");
const unzipper = require("unzipper");
const fs = require("fs");

async function run() {
  const filePath = path.join(__dirname, "file.zip");
  const destDir = __dirname;

  await fs
    .createReadStream(filePath)
    .pipe(unzipper.Extract({ path: destDir }))
    .promise();
}

run();

unzipper library have not had any update for almost a year now. perhaps change to a different library to unzip archives? node-stream-zip may be a good option, tested with both node 18 and 20 with the following code change

const path = require("path");
const StreamZip = require("node-stream-zip");

async function run() {
  const filePath = path.join(__dirname, "file.zip");
  const destDir = __dirname;

  const zip = new StreamZip.async({ file: filePath });
  await zip.extract(null, destDir);
  await zip.close();
}

run();

Thanks @jackie-linz A fix for this is merged.

You may test this using the latest commit from main

- uses: robinraju/release-downloader@937fc82288c40676a70174c74daa8cd4f924659e
  with:
    repository: "owner/repo"
    fileName: "foo.zip"
    latest: true
    extract: true

@robinraju tested and confirmed that the issue is resolve for us