diff options
author | Jaakko Keränen <jaakko.keranen@iki.fi> | 2020-08-28 14:17:45 +0300 |
---|---|---|
committer | Jaakko Keränen <jaakko.keranen@iki.fi> | 2020-08-28 14:17:45 +0300 |
commit | 1fb519c053ba24fa76a2a527b4d2c74b0f198e66 (patch) | |
tree | cf839dca9e5513fdeff2d19548836b966ba20226 /src/ui/documentwidget.c | |
parent | 81e0a90a79de49d2d65fd19ec924f21a1f8ee325 (diff) |
DocumentWidget: Fixed submission of user input
Diffstat (limited to 'src/ui/documentwidget.c')
-rw-r--r-- | src/ui/documentwidget.c | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/src/ui/documentwidget.c b/src/ui/documentwidget.c index 77733f88..1c8a51c9 100644 --- a/src/ui/documentwidget.c +++ b/src/ui/documentwidget.c | |||
@@ -1102,18 +1102,16 @@ static iBool handleCommand_DocumentWidget_(iDocumentWidget *d, const char *cmd) | |||
1102 | return iTrue; | 1102 | return iTrue; |
1103 | } | 1103 | } |
1104 | else if (equal_Command(cmd, "document.input.submit")) { | 1104 | else if (equal_Command(cmd, "document.input.submit")) { |
1105 | if (arg_Command(cmd)) { | 1105 | iString *value = collect_String(suffix_Command(cmd, "value")); |
1106 | iString *value = collect_String(suffix_Command(cmd, "value")); | 1106 | urlEncode_String(value); |
1107 | urlEncode_String(value); | 1107 | iString *url = collect_String(copy_String(d->mod.url)); |
1108 | iString *url = collect_String(copy_String(d->mod.url)); | 1108 | const size_t qPos = indexOfCStr_String(url, "?"); |
1109 | const size_t qPos = indexOfCStr_String(url, "?"); | 1109 | if (qPos != iInvalidPos) { |
1110 | if (qPos != iInvalidPos) { | 1110 | remove_Block(&url->chars, qPos, iInvalidSize); |
1111 | remove_Block(&url->chars, qPos, iInvalidSize); | ||
1112 | } | ||
1113 | appendCStr_String(url, "?"); | ||
1114 | append_String(url, value); | ||
1115 | postCommandf_App("open url:%s", cstr_String(url)); | ||
1116 | } | 1111 | } |
1112 | appendCStr_String(url, "?"); | ||
1113 | append_String(url, value); | ||
1114 | postCommandf_App("open url:%s", cstr_String(url)); | ||
1117 | return iTrue; | 1115 | return iTrue; |
1118 | } | 1116 | } |
1119 | else if (equal_Command(cmd, "valueinput.cancelled") && | 1117 | else if (equal_Command(cmd, "valueinput.cancelled") && |