http://sourceforge.net/tracker/index.php?func=detail&aid=3095552&...
Brief synopsis: escape char handling in the new treeview hotlist URL
code is broken, in that it considers colons and slashes, among other
things, to be invalid characters. Thus, editing an entry for
riscos.info in the hotlist causes it to change from:
http://www.riscos.info/index.php/RISC_OS
to:
http://http%3a%2f%2fwww.riscos.info%2findex.php%2frisc_os/
The code responsible is in desktop/tree_url_node.c, function
tree_url_node_callback(), from line 398 (case
NODE_ELEMENT_EDIT_FINISHING:).
In my initial post, I believed the fault was merely that of
over-enthusiastic escaping of characters, but I've now had a more
detailed think about the problem and I've realised that it was erroneous
to call url_escape() in the first place, as its function is to remove
characters which carry special meaning - in other words, any characters
which tell you anything about the URL at all.
In the case of the hotlist, the only items in there under normal
circumstances will be those that have been added from a browser window -
i.e. those that are, by definition, valid. Therefore, the only possible
consequence of escaping a URL which is intended to be launched later is
to break it.
Another fault with the current system is that it doesn't even manage to
pick up URLs that *are* invalid. A blank string, for example, will
simply translate to "http:///".
In light of this, my revised and totally untested (I don't even know if
it compiles) diff is (sorry about the indentation, I did change it but
diff doesn't think so):
--- RAM::RamDisc0.$.tree_url_node/c 2010-10-27 20:08:25.0 +0100
+++ RAM::RamDisc0.$.tree_url_node2/c 2010-10-27 20:08:25.0 +0100
@@ -360,7 +360,7 @@
struct node_element *element;
url_func_result res;
const char *text;
- char *norm_text, *escaped_text;
+ char *norm_text;
const struct url_data *data;
/** @todo memory leaks on non-shared folder deletion. */
@@ -400,10 +400,7 @@
text = msg_data->data.text;
if (msg_data->flag == TREE_ELEMENT_URL) {
- res = url_escape(text, 0, false, NULL,
- &escaped_text);
- if (res == URL_FUNC_OK)
- res = url_normalize(escaped_text,
+ res = url_normalize(text,
&norm_text);
if (res != URL_FUNC_OK) {
if (res == URL_FUNC_FAILED) {
--
__<^>__
/ _ _ \ I don't have a problem with God; it's his fan club I can't stand.
( ( |_| ) )
\_> <_/ ======================= Martin Bazley ==========================