Просмотр исходного кода

Correct JSON escaping in GPIO capabilities response

SybexXx 3 дней назад
Родитель
Сommit
7abf853204
1 измененных файлов с 5 добавлено и 5 удалено
  1. 5 5
      code/components/jomjol_controlGPIO/server_GPIO.cpp

+ 5 - 5
code/components/jomjol_controlGPIO/server_GPIO.cpp

@@ -689,16 +689,16 @@ esp_err_t GpioHandler::handleHttpRequest(httpd_req_t *req)
                 return ESP_OK;
             }
 
-            std::string response = "{\\"profile\\":\\"";
+            std::string response = "{\"profile\":\"";
             response += profile->name;
-            response += "\\",\\"maxChannels\\":";
+            response += "\",\"maxChannels\":";
             response += std::to_string(profile->maxUserChannels);
-            response += ",\\"pins\\":[";
+            response += ",\"pins\":[";
             for (size_t i = 0; i < profile->userPinCount; ++i) {
                 if (i > 0U) response += ",";
-                response += "{\\"gpio\\":";
+                response += "{\"gpio\":";
                 response += std::to_string(static_cast<int>(profile->userPins[i].gpio));
-                response += ",\\"capabilities\\":";
+                response += ",\"capabilities\":";
                 response += std::to_string(profile->userPins[i].capabilities);
                 response += "}";
             }