mirror of
https://github.com/wekan/wekan.git
synced 2026-11-24 09:59:47 -05:00
The attachment REST API carried every file as base64 inside JSON: an upload gathered the whole body into a string, decoded it and stored it, and a download read the whole file and encoded it - the file and its base64 copy in memory at once, up to the API limits. Beside that form, each route now takes the file itself: an upload whose body is the file (any Content-Type but JSON, its card or board in the query) streams into storage, and ?raw=1 on a download streams the file out, served as a download that cannot run in WeKan's origin. Both make the same checks first - one helper now holds the card upload checks for both forms - and the API limits are checked against Content-Length before reading and counted as the bytes flow. api.py uses the raw form for its four attachment and background commands, streaming from and to disk. The DDP methods stay base64 by their nature; docs/API/Attachments.md says to use the raw routes for large files. Removed from TODO Later. Thanks to markusst1982 and xet7 !