this time for sure

This commit is contained in:
Gábor Poczkodi 2024-11-14 23:30:06 +01:00
parent f7abab00c5
commit 7ec3e0391f

View file

@ -66,11 +66,9 @@ void StoreYamlComponent::handleRequest(AsyncWebServerRequest *request) {
uint8_t *ptr = buffer; uint8_t *ptr = buffer;
// 5KB+ config file with a single character repeating will result in a 100 byte long word, not likely // 5KB+ config file with a single character repeating will result in a 100 byte long word, not likely
while (max_len > 100) { while (max_len > 100) {
std::string s;
if (!this->web_dec_) { if (!this->web_dec_) {
this->web_dec_ = make_unique<Decompressor>(ESPHOME_YAML, ESPHOME_YAML_SIZE); this->web_dec_ = make_unique<Decompressor>(ESPHOME_YAML, ESPHOME_YAML_SIZE);
}
std::string s;
if (index == 0) {
s = this->web_dec_->get_first(); s = this->web_dec_->get_first();
} else { } else {
s = this->web_dec_->get_next(); s = this->web_dec_->get_next();
@ -86,6 +84,7 @@ void StoreYamlComponent::handleRequest(AsyncWebServerRequest *request) {
} }
return ptr - buffer; return ptr - buffer;
}; };
this->web_dec_ = nullptr;
AsyncWebServerResponse *response = request->beginChunkedResponse("text/plain;charset=UTF-8", cb); AsyncWebServerResponse *response = request->beginChunkedResponse("text/plain;charset=UTF-8", cb);
#else #else
AsyncResponseStream *response = request->beginResponseStream("text/plain;charset=UTF-8"); AsyncResponseStream *response = request->beginResponseStream("text/plain;charset=UTF-8");