multitheftauto / mtasa-blue

Multi Theft Auto is a game engine that incorporates an extendable network play element into a proprietary commercial single-player game.
https://multitheftauto.com
GNU General Public License v3.0
1.38k stars 424 forks source link

Add zip related functions to lua #3637

Open TracerDS opened 1 month ago

TracerDS commented 1 month ago

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

Disinterpreter commented 1 month ago

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.

TracerDS commented 1 month ago

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

CrosRoad95 commented 1 month ago

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.