BL-1649 Add fluent ZipFile utility for compress, extract, and list ZIP archives#484
BL-1649 Add fluent ZipFile utility for compress, extract, and list ZIP archives#484franciscosierra1915 wants to merge 4 commits into
Conversation
|
Hi @franciscosierra1915 ! So, looking over this
Most of our team is at a conference right now, but we can get on a call to discuss so we're all on the same page if you like. |
lmajano
left a comment
There was a problem hiding this comment.
Overall, you need to cleanup this PR a lot.
There are tons of unecessary files that should not be here.
The ZipFile fluent class like @bdw429s said should follow the same pattern as the PropertyFile approach.
It starts from the entry point which are the Built In Functions (BIFS). Just like we have a PropertyFile BIF, we need a ZipFile BIF following the same pattern.
The ZipFile object should delegate to our ZipUtil for all operations.
| @@ -0,0 +1,228 @@ | |||
| package ortus.boxlang.runtime.util; | |||
There was a problem hiding this comment.
This File is only a fluent delegator. All the logic should be kept in the ZipUtil that exists already. Take a look at the PropertyFile for inspiration.
| @@ -0,0 +1,8 @@ | |||
| { | |||
There was a problem hiding this comment.
Why is this here? This file doesn't belong here.
Also, testbox should NOT be committed to the repo.
Everything is already in cluded in the project in order to have dependencies and test.
Just run the gradle tests as per the contributing doc.
| @@ -0,0 +1,111 @@ | |||
| franciscosierramunoz@Franciscos-MacBook-Air-4 BoxLang % box testbox run "bundles=tests.specs.ZipFileTest" | |||
| @@ -0,0 +1,16 @@ | |||
| // Compress | |||
| @@ -0,0 +1,5 @@ | |||
| { | |||
| @@ -0,0 +1 @@ | |||
| println("Test complete!"); | |||
|
@bdw429s you want to direct here since we have a |
Description
This pull request introduces a new fluent utility class
ZipFilein theruntime.utilpackage to support basic ZIP file operations.The implementation follows the same fluent API pattern used by other utilities in the project (such as
PropertyFile) by allowing method chaining through returningthis.The new
ZipFileclass provides the following functionality:.ziparchive..ziparchive into a destination directory..ziparchive without extracting it.The implementation uses Java's built-in
java.util.zippackage, specifically:ZipOutputStreamZipInputStreamjava.util.zip.ZipFileSecurity protections were implemented to prevent ZIP Slip attacks by validating normalized paths during extraction.
Example usage:
This feature introduces the foundation for fluent ZIP utilities in the runtime and follows the architectural and coding patterns already established in the project.
No external dependencies were added.
Jira Issues
Jira Issue:
BL-1649
https://ortussolutions.atlassian.net/browse/BL-1649
Bug Tracker:
https://ortussolutions.atlassian.net/browse/BL/issues
Type of change
Checklist