Merge lp:~roignac/gwibber/Bug324809 into lp:gwibber

Proposed by Vadim Rutkovsky
Status: Merged
Merged at revision: 935
Proposed branch: lp:~roignac/gwibber/Bug324809
Merge into: lp:gwibber
Diff against target: 25 lines (+5/-3)
1 file modified
gwibber/microblog/util/__init__.py (+5/-3)
To merge this branch: bzr merge lp:~roignac/gwibber/Bug324809
Reviewer Review Type Date Requested Status
Ken VanDine Approve
Omer Akram (community) Approve
Review via email: mp+33992@code.launchpad.net

Description of the change

Fixes lp:324809 - urls like www.google.com are recognized correctly, http:// is added to the href

To post a comment you must log in.
Revision history for this message
Omer Akram (om26er) wrote :

works

review: Approve
Revision history for this message
Ken VanDine (ken-vandine) wrote :

Thanks!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'gwibber/microblog/util/__init__.py'
--- gwibber/microblog/util/__init__.py 2010-08-22 18:30:36 +0000
+++ gwibber/microblog/util/__init__.py 2010-08-28 12:33:42 +0000
@@ -17,8 +17,8 @@
17URL_SCHEMES = ('http', 'https', 'ftp', 'mailto', 'news', 'gopher',17URL_SCHEMES = ('http', 'https', 'ftp', 'mailto', 'news', 'gopher',
18 'nntp', 'telnet', 'wais', 'prospero', 'aim', 'webcal')18 'nntp', 'telnet', 'wais', 'prospero', 'aim', 'webcal')
1919
20URL_FORMAT = (r'(?<!\w)((?:%s):' # protocol + :20URL_FORMAT = (r'(?<!\w)(((?:%s)://|(?:www\.))' # protocol + :// or www.
21 '/*(?!/)(?:' # get any starting /'s21 '(?!/)(?:' # get any starting /'s
22 '[\w$\+\*@&=\-/]' # reserved | unreserved22 '[\w$\+\*@&=\-/]' # reserved | unreserved
23 '|%%[a-fA-F0-9]{2}' # escape23 '|%%[a-fA-F0-9]{2}' # escape
24 '|[\?\.:\(\),;!\'\~](?!(?:\s|$))' # punctuation24 '|[\?\.:\(\),;!\'\~](?!(?:\s|$))' # punctuation
@@ -37,7 +37,9 @@
37def linkify(text, subs=[], escape=True):37def linkify(text, subs=[], escape=True):
38 if escape: text = cgi.escape(text)38 if escape: text = cgi.escape(text)
39 for f, r in subs: text = f.sub(r, text)39 for f, r in subs: text = f.sub(r, text)
40 return PARSE_LINK.sub('<a href="\\1">\\1</a>', text)40 link = PARSE_LINK.sub('<a href="\\1">\\1</a>', text)
41 # if link has www only, add http:// to the href
42 return re.compile(r'"www.', re.U).sub('"http://www.', link)
4143
42def imgpreview(text):44def imgpreview(text):
43 thumbre = {45 thumbre = {