Skip to content
This repository has been archived by the owner on May 15, 2024. It is now read-only.

zip.ExtractAll() System.IO.IOException: 'Cannot create a file when that file already exists. #293

Open
Mehuge opened this issue Apr 30, 2024 · 0 comments

Comments

@Mehuge
Copy link

Mehuge commented Apr 30, 2024

Trying to extract a node_modules zip, and hitting this exception early on. The extract is left with a .tmp file on one of the nested folders.

I cut down the node_modules.zip and copied one problem folder around and it seems the be the level of nesting of the folder that is causing the problem.

private void button1_Click(object sender, EventArgs e)
{
  using (ZipFile zip = new ZipFile("C:\\DEV\\WindowsFormsApp1\\node_modules.zip"))
  {
    zip.ExtractAll("C:\\DEV\\WindowsFormsApp1\\");
  }
}

Folder structure in the ZIP

dist
  esm
    estree-walker.js
node_modules
  dist
    esm
      estree-walker.js
  estree-walker
    dist
      esm
        estree-walker.js

(the dist folder was replicated at different levels in the zip for testing, originally just under estree-walker folder)

The resuting output is

dist
   esm
      estree-walker.js
node_modules
  dist
    esm
      estree-walker.js
  estree-walker
    dist
      DotNetZip-ulvesib3.tmp

and the above exception.

node_modules.zip

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant