zerkman / zzlib

zip/zlib-compressed file depacking library in Lua
Do What The F*ck You Want To Public License
87 stars 21 forks source link

Support archives with comments. #14

Open TohruMKDM opened 2 years ago

TohruMKDM commented 2 years ago

You can reliably strip away comments (at least based off of my testing) thus allowing this project to work as intended.

local start = string.find(data, 'PK\5\6')
if start then
    data = string.sub(data, 1, start + 19)..'\0\0'
end

with data being the bitstream's buffer.

zerkman commented 2 years ago

thanks for the suggestion, but what happens if the 'PK\5\6' string appears in the packed data ? Supporting comments is an open door to unwanted behaviour. I'm not even sure modern zip management tools support comments in zip files anyway. So, better not support it at all.

TohruMKDM commented 2 years ago

I did not think of that. Wouldn't you just be able to search for that string in reverse? The last instance of it should always be the comment.

justdie386 commented 8 months ago

Hey, i'd like to use this project, but it seems i am having the same issue with comments, has any progress been made? any known fix to ignore the comments?

I'd really like to use this library because it looks awesome, and its written in pure lua so no compiling hassle like every other lua unzip libraries out there