travcunn / django-zip-stream

Django extension to assemble ZIP archives dynamically using Nginx.
MIT License
13 stars 2 forks source link

Big fixes and improvements #22

Open yspreen opened 4 years ago

yspreen commented 4 years ago

Fixes line endings, add crc, add automatic folder search, add link to nginx with the mod.

yspreen commented 4 years ago

Made the commits pretty small, you can basically see a list of changes in the messages.

travcunn commented 4 years ago

Hey, thanks for submitting this change! I'll see if I can put together some test cases. I haven't maintained this package for a while but I'd like to improve it if you are using it.

yspreen commented 4 years ago

Yeah, so I tried to just make it easier to use the package at first, adding the convenience class for folders. But then I quickly found out that something didn't work.

I tried adding CRC at first, but the issue persisted. Turns out the zip module may have changed (?) and now requires \r\n.
After finding that out and fixing it, I decided to create the PR.

For the line endings, I found out through the tip at nginx:

Each line should have no whitespace before the CRC-32 field. At the end of the line, rn. No empty or extra lines.

yspreen commented 4 years ago

Btw, quick research into pathlib yielded, that the functionality was added in Python 3.4.
It probably works in Python 2 too, but I didn't test it. Since 2 is ending its support in less than 2 months I think it should be fine to remove the compatibility.

yspreen commented 4 years ago

@travcunn I still have success using my own fork of this. Merging might still be helpful to others though :)