Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: cms/sources.py

Issue 29376948: Noissue - Adding support for tel link scheme in Source.resolve_link of CMS (Closed) Base URL: https://hg.adblockplus.org/cms
Patch Set: Created Feb. 23, 2017, 3:50 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # This file is part of the Adblock Plus web scripts, 1 # This file is part of the Adblock Plus web scripts,
2 # Copyright (C) 2006-2016 Eyeo GmbH 2 # Copyright (C) 2006-2016 Eyeo GmbH
3 # 3 #
4 # Adblock Plus is free software: you can redistribute it and/or modify 4 # Adblock Plus is free software: you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License version 3 as 5 # it under the terms of the GNU General Public License version 3 as
6 # published by the Free Software Foundation. 6 # published by the Free Software Foundation.
7 # 7 #
8 # Adblock Plus is distributed in the hope that it will be useful, 8 # Adblock Plus is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of 9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
(...skipping 11 matching lines...) Expand all
22 import subprocess 22 import subprocess
23 import urlparse 23 import urlparse
24 import zipfile 24 import zipfile
25 import logging 25 import logging
26 26
27 27
28 class Source: 28 class Source:
29 def resolve_link(self, url, locale): 29 def resolve_link(self, url, locale):
30 parsed = urlparse.urlparse(url) 30 parsed = urlparse.urlparse(url)
31 page = parsed.path 31 page = parsed.path
32 if parsed.scheme != '' or page.startswith('/') or page.startswith('.'): 32 # manually testing tel scheme because it is not recoginzed by urlparse
Vasily Kuznetsov 2017/02/23 19:03:29 I think it would be better to make this special ca
33 if parsed.scheme != '' or url.startswith('tel:') or page.startswith('/') or page.startswith('.'):
33 # Not a page link 34 # Not a page link
34 return None, None 35 return None, None
35 36
36 if page == '' and url != '': 37 if page == '' and url != '':
37 # Page-relative link 38 # Page-relative link
38 return None, None 39 return None, None
39 40
40 config = self.read_config() 41 config = self.read_config()
41 default_locale = config.get('general', 'defaultlocale') 42 default_locale = config.get('general', 'defaultlocale')
42 default_page = config.get('general', 'defaultpage') 43 default_page = config.get('general', 'defaultpage')
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
292 path = os.path.join(dir, filename) 293 path = os.path.join(dir, filename)
293 if os.path.isfile(path): 294 if os.path.isfile(path):
294 result.append(relpath + filename) 295 result.append(relpath + filename)
295 elif os.path.isdir(path): 296 elif os.path.isdir(path):
296 do_list(path, relpath + filename + '/') 297 do_list(path, relpath + filename + '/')
297 do_list(self.get_path(subdir), '') 298 do_list(self.get_path(subdir), '')
298 return result 299 return result
299 300
300 def get_cache_dir(self): 301 def get_cache_dir(self):
301 return os.path.join(self._dir, 'cache') 302 return os.path.join(self._dir, 'cache')
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld