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

Activity

Show:
Pothys - MitrahSoft
November 21, 2018, 7:25 AM

Added the fix too.

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

Michael Offner
December 3, 2018, 9:51 AM
Matt Levine
January 23, 2020, 7:02 AM
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.

 

Matt Levine
January 23, 2020, 6:49 PM

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.

Zac Spitzer
January 24, 2020, 8:48 AM

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

Fixed

Assignee

Michael Offner

Reporter

Brad Wood

Priority

New

Labels

Fix versions

Sprint

None
Configure