Closed alestiago closed 8 months ago
I'm trying to figure out what you're doing here, but yes there does seem to be a problem. You're zipping a directory, and the path of the zip file being created is inside the directory you're zipping.
My thought is it should throw an exception in this case.
My thought is it should throw an exception in this case.
I'm happy with this approach! Would you like me to contribute or do you prefer taking care of this?
I'd be glad if you could take care of it, thanks!
Fantastic! Feel free to assign this to me, I will look into making a Pull Request between this week and next week.
Description
When using
zipDirectory
and specifying thefilename
as a path within thedirectory
, the resulting zipped file will have a corrupted zip inside.Minimal reproductive sample code
Repository with sample code
Run the above snippet of code locally and unzip the output's directory zip file. It will have the text file and a corrupted zip.
Proposals
filename
's path is nested withindirectory.path
filename
being a path and only extract the filename from thefilename
pathAdditional context