overwrite=true no longer works in cfzip action=unzip

Description

This is possibly related to:
https://luceeserver.atlassian.net/browse/LDEV-941

When unzipping a zip file into an existing directory and attempting to overwrite existing files with the overwrite flag, the files are not overwritten. This has broken the upgrade command in CommandBox.

I have attached a zip file that has a small test case. The test case uses a CommandBox Task Runner. Unzip the folder and run box task run to execute the task runner. I'm sure this can easily be reworked into a normal test case. The task runner was just quick and easy to test it from the command line.

Run the task which unzips the myZip.zip archive into the target folder. Then modify the myFile.txt which was created in the target folder. Your changes will not be overwritten as they should be.

Environment

None

Attachments

1
  • 25 Oct 2018, 10:09 pm

Activity

Show:

Zac Spitzer 24 January 2020 at 08:48

can you create a new ticket and link it to this one?

Matt Levine 23 January 2020 at 18:49

Or in my case I’m using the entrypath attribute. Would it make sense that it only overwrites wipes out directories in the specified entrypath under the destination.

Matt Levine 23 January 2020 at 07:02
Edited

Is the behavior for overwrite supposed to overwrite whole directories if they exist? Does it makes sense to adjust the fix to this?

if(target.exists() && overwrite) target.delete();

to

if(target.exists() && !target.isDirectory() && overwrite) target.delete();

I’m testing with 5.3.2.77 on Java 8.

 

Pothys - MitrahSoft 21 November 2018 at 07:25

Added the fix too.

Pull Request: https://github.com/lucee/Lucee/pull/599

Fixed

Details

Assignee

Reporter

Priority

Labels

Fix versions

New Issue warning screen

Before you create a new Issue, please post to the mailing list first https://dev.lucee.org

Once the issue has been verified, one of the Lucee team will ask you to file an issue

Sprint

Created 25 October 2018 at 22:09
Updated 8 May 2020 at 18:46
Resolved 7 March 2019 at 14:06

Flag notifications