diff options
author | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-01-26 06:53:56 +0200 |
---|---|---|
committer | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-01-26 06:53:56 +0200 |
commit | 90d1acd4a88822675208f5e1d445b5017f7cbfb8 (patch) | |
tree | 3dd241e86a91bcb165418613188d31660e27a2c1 /src/ui/inputwidget.c | |
parent | f77783568b02a3869e9f7d0e6fa918eadd98b506 (diff) |
InputWidget: Optional domain punycoding for UI
Diffstat (limited to 'src/ui/inputwidget.c')
-rw-r--r-- | src/ui/inputwidget.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/ui/inputwidget.c b/src/ui/inputwidget.c index 6992bbec..62f0341e 100644 --- a/src/ui/inputwidget.c +++ b/src/ui/inputwidget.c | |||
@@ -224,6 +224,16 @@ static void updateBuffered_InputWidget_(iInputWidget *d) { | |||
224 | } | 224 | } |
225 | 225 | ||
226 | void setText_InputWidget(iInputWidget *d, const iString *text) { | 226 | void setText_InputWidget(iInputWidget *d, const iString *text) { |
227 | if (d->inFlags & isUrl_InputWidgetFlag) { | ||
228 | /* If user wants URLs encoded, also Punycode the domain. */ | ||
229 | if (!prefs_App()->decodeUserVisibleURLs) { | ||
230 | iString *enc = collect_String(copy_String(text)); | ||
231 | /* Prevent address bar spoofing (mentioned as IDN homograph attack in | ||
232 | https://github.com/skyjake/lagrange/issues/73) */ | ||
233 | punyEncodeUrlHost_String(enc); | ||
234 | text = enc; | ||
235 | } | ||
236 | } | ||
227 | clearUndo_InputWidget_(d); | 237 | clearUndo_InputWidget_(d); |
228 | clear_Array(&d->text); | 238 | clear_Array(&d->text); |
229 | iConstForEach(String, i, text) { | 239 | iConstForEach(String, i, text) { |