mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-01-12 07:59:29 -05:00
Fix: WebUI truncating binary files.
Fixes font files not loading properly in the webui problem.
This commit is contained in:
parent
a6573826b2
commit
bb6841370f
@ -76,21 +76,21 @@ public:
|
|||||||
|
|
||||||
std::string resource_filename = _base_directory + "/" + directory + filename;
|
std::string resource_filename = _base_directory + "/" + directory + filename;
|
||||||
RsDbg() << "Reading file: \"" << resource_filename << "\"" << std::endl;
|
RsDbg() << "Reading file: \"" << resource_filename << "\"" << std::endl;
|
||||||
std::ifstream stream( resource_filename, std::ifstream::in );
|
std::ifstream stream( resource_filename, std::ifstream::binary);
|
||||||
|
|
||||||
if(stream.is_open())
|
if(stream.is_open())
|
||||||
{
|
{
|
||||||
const std::string body = std::string(
|
const std::vector<uint8_t> body = std::vector<uint8_t>(
|
||||||
std::istreambuf_iterator<char>(stream),
|
std::istreambuf_iterator<char>(stream),
|
||||||
std::istreambuf_iterator<char>() );
|
std::istreambuf_iterator<char>() );
|
||||||
|
|
||||||
RsDbg() << __PRETTY_FUNCTION__
|
RsDbg() << __PRETTY_FUNCTION__
|
||||||
<< " body length=" << body.length() << std::endl;
|
<< " body length=" << body.size() << std::endl;
|
||||||
|
|
||||||
const std::multimap<std::string, std::string> headers
|
const std::multimap<std::string, std::string> headers
|
||||||
{
|
{
|
||||||
{ "Content-Type", mime_types[MIME_TYPE_INDEX] },
|
{ "Content-Type", mime_types[MIME_TYPE_INDEX] },
|
||||||
{ "Content-Length", std::to_string(body.length()) }
|
{ "Content-Length", std::to_string(body.size()) }
|
||||||
};
|
};
|
||||||
|
|
||||||
session->close(restbed::OK, body, headers);
|
session->close(restbed::OK, body, headers);
|
||||||
|
Loading…
Reference in New Issue
Block a user