Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

fix erroneous backslash escapes in urls passed to external browser

  • Loading branch information...
commit eea45b291de9fed43f9d8c757ae43fb8a8bee79c 1 parent e5a4b15
@termac termac authored
Showing with 9 additions and 10 deletions.
  1. +7 −9 canto/canto_fetch.py
  2. +2 −1  canto/interface_draw.py
View
16 canto/canto_fetch.py
@@ -391,15 +391,13 @@ def run(self):
newfeed["canto_version"] = VERSION_TUPLE
# For all content that we would usually use, we escape all of the
- # slashes and other potential escapes.
-
- def escape(s):
- s = s.replace("\\","\\\\")
- return s.replace("%", "\\%")
+ # slashes and other potential escapes, except for the link item,
+ # which is escaped in the reader when it is displayed. This is to
+ # prevent sending garbeled links to the exteranl browser.
for key in newfeed["feed"]:
if type(newfeed["feed"][key]) in [unicode,str]:
- newfeed["feed"][key] = escape(newfeed["feed"][key])
+ newfeed["feed"][key] = utility.stripchars(newfeed["feed"][key])
for entry in newfeed["entries"]:
for subitem in ["content","enclosures"]:
@@ -407,11 +405,11 @@ def escape(s):
for e in entry[subitem]:
for k in e.keys():
if type(e[k]) in [unicode,str]:
- e[k] = escape(e[k])
+ e[k] = utility.stripchars(e[k])
for key in entry.keys():
- if type(entry[key]) in [unicode,str]:
- entry[key] = escape(entry[key])
+ if type(entry[key]) in [unicode,str] and key != "link":
+ entry[key] = utility.stripchars(entry[key])
for entry in newfeed["entries"]:
# If the item didn't come with a GUID, then
View
3  canto/interface_draw.py
@@ -56,6 +56,7 @@
from widecurse import core, tlen
import canto_html
+import utility
import locale
import re
@@ -429,7 +430,7 @@ def reader_render_links(self, dict):
color = u"%8"
dict["content"] += color + u"[" + unicode(idx) + u"] " + \
- link[0] + u"%1 - " + link[1] + "\n"
+ link[0] + u"%1 - " + utility.stripchars(link[1]) + "\n"
def reader_highlight_quotes(self, dict):
dict["content"] = self.highlight_quote_rgx.sub(u"%5\"\\1\"%0",\
Please sign in to comment.
Something went wrong with that request. Please try again.