Skip to content
This repository was archived by the owner on May 15, 2024. It is now read-only.
This repository was 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

@Mehuge

Description

@Mehuge

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions