mirror of
https://github.com/arendst/Tasmota.git
synced 2025-07-23 10:46:31 +00:00
Verify correct functionality
This commit is contained in:
parent
43bc81010f
commit
258976c014
@ -2236,7 +2236,7 @@ void HandleBackupConfiguration(void)
|
||||
AddLog(LOG_LEVEL_DEBUG, PSTR(D_LOG_HTTP D_BACKUP_CONFIGURATION));
|
||||
|
||||
uint32_t config_len = SettingsConfigBackup();
|
||||
if (!config_len) { return; } // Unable to allocate 4k buffer
|
||||
if (!config_len) { return; } // Unable to allocate buffer
|
||||
|
||||
WiFiClient myClient = Webserver->client();
|
||||
Webserver->setContentLength(config_len);
|
||||
@ -3372,10 +3372,11 @@ int WebGetConfig(char *buffer) {
|
||||
if (http_code == HTTP_CODE_OK || http_code == HTTP_CODE_MOVED_PERMANENTLY) {
|
||||
WiFiClient *stream = http.getStreamPtr();
|
||||
int len = http.getSize();
|
||||
// if ((len <= sizeof(TSettings)) && SettingsBufferAlloc()) {
|
||||
if (len <= sizeof(TSettings)) {
|
||||
len = sizeof(TSettings);
|
||||
}
|
||||
if (SettingsBufferAlloc(len)) {
|
||||
uint8_t *buff = settings_buffer;
|
||||
if (len == -1) { len = settings_size; }
|
||||
while (http.connected() && (len > 0)) {
|
||||
size_t size = stream->available();
|
||||
if (size) {
|
||||
|
@ -96,9 +96,9 @@ uint32_t MqttFileUploadValidate(uint32_t rcv_id) {
|
||||
|
||||
// Check buffer size
|
||||
if (UPL_SETTINGS == FMqtt.file_type) {
|
||||
// if (FMqtt.file_size > sizeof(TSettings)) {
|
||||
// return 2; // Settings supports max 4k size
|
||||
// }
|
||||
if (!SettingsBufferAlloc(FMqtt.file_size)) {
|
||||
return 2; // Settings supports max size
|
||||
}
|
||||
} else { // Check enough flash space for intermediate upload
|
||||
uint32_t head_room = (FlashWriteMaxSector() - FlashWriteStartSector()) * SPI_FLASH_SEC_SIZE;
|
||||
uint32_t rounded_size = (FMqtt.file_size + SPI_FLASH_SEC_SIZE -1) & (~(SPI_FLASH_SEC_SIZE - 1));
|
||||
@ -109,12 +109,7 @@ uint32_t MqttFileUploadValidate(uint32_t rcv_id) {
|
||||
|
||||
// Init file_buffer
|
||||
if (UPL_SETTINGS == FMqtt.file_type) {
|
||||
// if (SettingsConfigBackup()) {
|
||||
if (SettingsBufferAlloc(FMqtt.file_size)) {
|
||||
FMqtt.file_buffer = settings_buffer;
|
||||
} else {
|
||||
return 2; // Settings supports max size
|
||||
}
|
||||
FMqtt.file_buffer = settings_buffer;
|
||||
}
|
||||
else {
|
||||
if (UPL_TASMOTA == FMqtt.file_type) {
|
||||
@ -347,7 +342,7 @@ uint32_t MqttFileDownloadValidate(void) {
|
||||
// Init file_buffer
|
||||
if (UPL_SETTINGS == FMqtt.file_type) {
|
||||
uint32_t len = SettingsConfigBackup();
|
||||
if (!len) { return 2; }
|
||||
if (!len) { return 2; } // Unable to allocate buffer
|
||||
|
||||
FMqtt.file_type = UPL_SETTINGS;
|
||||
FMqtt.file_buffer = settings_buffer;
|
||||
|
Loading…
x
Reference in New Issue
Block a user