Maybe fix large file downloads
Some checks reported warnings
/ Build the server (push) Has been cancelled

This commit is contained in:
Mutzi 2024-04-13 14:01:06 +02:00
parent 2a1c3a9f72
commit 55d1f4cc7f
Signed by: root
GPG Key ID: 2437494E09F13876

View File

@ -58,6 +58,7 @@ void Server::download(const std::shared_ptr<restbed::Session> &s) {
restbed::Bytes buf(1024*1024*4, 0);
std::ifstream f{user->user_dir / std::to_string(node->id)};
while (!f.eof()) {
buf.resize(buf.capacity());
f.read((char*)buf.data(), buf.size());
buf.resize(f.gcount());
s->yield(buf);