aleph-im/pyaleph

Upload Endpoint file reading

Opened this issue · 0 comments

1yam commented

On : Storage Endpoint

Problem Description:
The current implementation of the file upload endpoint reads the entire file before checking if it exceeds the maximum allowed size for unauthenticated uploads (MAX_UNAUTHENTICATED_UPLOAD_FILE_SIZE = 25 * MiB) or (MAX_UPLOAD_FILE_SIZE = 1000 * MiB) for authenticated uploads.

Impact:
This leads to unnecessary memory usage and potential performance degradation, especially with large files or high volumes of traffic, which could risk server stability.

Suggested Improvement:
The file size should be checked against the maximum allowed size before the file is fully read into memory to prevent these issues.