From cdd289a7ff22dfde2ee970168bad439dd9c4a891 Mon Sep 17 00:00:00 2001
From: Oliver Schmidt
Date: Mon, 25 May 2015 18:18:44 +0200
Subject: [PATCH] Ignore fragment-only links.
We don't handle URLs with fragments exactly ;-) well - meaning we send the fragment part to the server and we don't display the document starting at the anchor tag. Instead of adding the missing capabilities and thus adding lots of code I instead opted to simply ignore fragment-only links. This approach is based on the practical knowledge that fragments are primarily used for intra-document navigation - and are as such fragment-only links. And as we ignore them anyway when displaying the document it's more ergonomic to not have those links in the first place.
---
apps/webbrowser/www.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/apps/webbrowser/www.c b/apps/webbrowser/www.c
index 8e1331c75..3acea84b5 100644
--- a/apps/webbrowser/www.c
+++ b/apps/webbrowser/www.c
@@ -170,11 +170,12 @@ static struct inputattrib *currptr;
#define ISO_nl 0x0a
#define ISO_space 0x20
+#define ISO_hash 0x23
#define ISO_ampersand 0x26
-#define ISO_plus 0x2b
+#define ISO_plus 0x2b
#define ISO_slash 0x2f
#define ISO_eq 0x3d
-#define ISO_questionmark 0x3f
+#define ISO_questionmark 0x3f
/* The state of the rendering code. */
static char *webpageptr;
@@ -886,7 +887,11 @@ htmlparser_word(char *word, unsigned char wordlen)
void
htmlparser_link(char *text, unsigned char textlen, char *url)
{
- add_pagewidget(text, textlen, url, CTK_WIDGET_HYPERLINK, 0);
+ if(url[0] == ISO_hash) {
+ htmlparser_word(text, textlen);
+ } else {
+ add_pagewidget(text, textlen, url, CTK_WIDGET_HYPERLINK, 0);
+ }
}
/*-----------------------------------------------------------------------------------*/
#if WWW_CONF_FORMS