mtasa-blue icon indicating copy to clipboard operation
mtasa-blue copied to clipboard

Add zip related functions to lua

Open TracerDS opened this issue 1 year ago • 3 comments

Is your feature request related to a problem? Please describe.

It would be great to introduce zip functions to mta lua to handle zip files directly. Many libraries could be easily updated with zip functions.

Describe the solution you'd like

zip-file zipOpen(string path)
bool zipAddFile(zip-file zipFile, string filePath/fileContent [, string fileName])
bool zipRemoveFile(zip-file zipFile, string filePath)
bool zipExtract(zip-file zipFile, string outDirectory)

async functions? zip operations could take several seconds. It would not be cool to freeze the client

Describe alternatives you've considered

No response

Additional context

No response

Security Policy

  • [X] I have read and understood the Security Policy and this issue is not about a cheat or security vulnerability.

TracerDS avatar Aug 11 '24 17:08 TracerDS

Yup, good idea. But ZIP it's little more than we can thing. There are lot of compression algorithms and type of compression. Pay your attention on it.

Disinterpreter avatar Aug 11 '24 17:08 Disinterpreter

Yup, good idea. But ZIP it's little more than we can thing. There are lot of compression algorithms and type of compression. Pay your attention on it.

Thats not a problem. The problem is lack of good api for zips. Current vendor is terrible at handling zip files

TracerDS avatar Aug 11 '24 17:08 TracerDS

it was rejected years ago because of hilarious reason "zip bombs" and "path traversal", don't remember exactly what mta staff member said it but he probably didn't notice that zlib already used in mta can limit how big is output is, it could be set to ~100MB AND i don't need zip to fill up your disk because file functions has no limits - also mentioned it YEARS ago. Path traversal protection is already in mta so just reuse it, inside "zip" userdata can be just std::map<std::string, std::string> therefore you don't even have a chance to execute any such attack.

CrosRoad95 avatar Aug 12 '24 17:08 CrosRoad95