Skip to content

Commit

Permalink
Fixed urlifying shared photos with Unicode content.
Browse files Browse the repository at this point in the history
  • Loading branch information
suurjaak committed Jun 26, 2015
1 parent d696ca4 commit 0758711
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions skyperious/skypedata.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
@author Erki Suurjaak
@created 26.11.2011
@modified 15.06.2015
@modified 26.06.2015
------------------------------------------------------------------------------
"""
import cgi
Expand Down Expand Up @@ -1782,11 +1782,10 @@ def parse_message_dom(self, message, options):
else: # Parse link from message contents
text = ElementTree.tostring(dom, "utf-8", "text")
match = re.search("(https?://[^\s<]+)", text)
if match:
if match: # Make link clickable
url = match.group(0)
# Make link clickable
linktempl = step.Template('<a href="{{url}}">{{url}}</a>')
text2 = text.replace(url, linktempl.expand(url=url))
a = step.Template('<a href="{{u}}">{{u}}</a>').expand(u=url)
text2 = text.replace(url, a.encode("utf-8"))
dom = self.make_xml(text2, message) or dom
else:
url = dom.find("URIObject").get("uri")
Expand Down

0 comments on commit 0758711

Please sign in to comment.