[GH-ISSUE #916] HTML injection freaking out #776

Open
opened 2026-02-28 01:27:00 +03:00 by kerem · 4 comments
Owner

Originally created by @OoM-JaN on GitHub (Jul 23, 2019).
Original GitHub issue: https://github.com/tzapu/WiFiManager/issues/916

Hi

Great piece of work. It's a great library but I'm stuck in the HTML insert.
Here is my code (partially):

String HtmlPage(){
    String htmlPageNoWiFi =
     String ( "<H1>TEST</H1>");
    return htmlPageNoWiFi;
}

void setup(){

  String y = HtmlPage();
  const char* z = "<H1>TEST</H1>";
  WiFiManagerParameter custom_text(z);

  wifiManager.addParameter(&custom_text);
  Serial.println(y);
  Serial.println(z);

This works perfectly and both 'y' and 'z' give the same output on the serial monitor.
If I change WiFiManagerParameter custom_text(z); to WiFiManagerParameter custom_text (y); I receive an error:

no matching function for call to 'WiFiManagerParameter::WiFiManagerParameter(String&)'

What am I doing wrong or how can I change (y) to work within the WifiManager?

Originally created by @OoM-JaN on GitHub (Jul 23, 2019). Original GitHub issue: https://github.com/tzapu/WiFiManager/issues/916 Hi Great piece of work. It's a great library but I'm stuck in the HTML insert. Here is my code (partially): ``` String HtmlPage(){ String htmlPageNoWiFi = String ( "<H1>TEST</H1>"); return htmlPageNoWiFi; } void setup(){ String y = HtmlPage(); const char* z = "<H1>TEST</H1>"; WiFiManagerParameter custom_text(z); wifiManager.addParameter(&custom_text); Serial.println(y); Serial.println(z); ``` This works perfectly and both 'y' and 'z' give the same output on the serial monitor. If I change WiFiManagerParameter custom_text(z); to WiFiManagerParameter custom_text (y); I receive an error: > no matching function for call to 'WiFiManagerParameter::WiFiManagerParameter(String&)' What am I doing wrong or how can I change (y) to work within the WifiManager?
Author
Owner

@tablatronix commented on GitHub (Jul 23, 2019):

convert to const char* ?

<!-- gh-comment-id:514336754 --> @tablatronix commented on GitHub (Jul 23, 2019): convert to const char* ?
Author
Owner

@OoM-JaN commented on GitHub (Jul 23, 2019):

const char* is the only way that custom_text 'eats' the String.
WiFiManagerParameter custom_text("<H1>TEST</H1>")
Works as well.

String z = "<H1>TEST</H1>";
'WiFiManagerParameter custom_text(z);

Doesn't work

<!-- gh-comment-id:514338538 --> @OoM-JaN commented on GitHub (Jul 23, 2019): const char* is the only way that custom_text 'eats' the String. `WiFiManagerParameter custom_text("<H1>TEST</H1>") ` Works as well. ``` String z = "<H1>TEST</H1>"; 'WiFiManagerParameter custom_text(z); ``` Doesn't work
Author
Owner

@tablatronix commented on GitHub (Jul 23, 2019):

Yeah you are trying to pass a string in, there is no string handler, maybe we should add one

<!-- gh-comment-id:514362841 --> @tablatronix commented on GitHub (Jul 23, 2019): Yeah you are trying to pass a string in, there is no string handler, maybe we should add one
Author
Owner

@wvsbsp commented on GitHub (Aug 12, 2019):

does ths work?
String z = "<H1>TEST</H1>";
WiFiManagerParameter custom_text(z.c_str());

<!-- gh-comment-id:520548404 --> @wvsbsp commented on GitHub (Aug 12, 2019): does ths work? `String z = "<H1>TEST</H1>";` `WiFiManagerParameter custom_text(z.c_str());`
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/WiFiManager#776
No description provided.