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

Unified Diff: publicSuffixListUpdater.py

Issue 29793567: Issue 6706 - Make "build.py updatepsl" encode domains as Punycode (Closed)
Patch Set: Created May 29, 2018, 3:17 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: publicSuffixListUpdater.py
===================================================================
--- a/publicSuffixListUpdater.py
+++ b/publicSuffixListUpdater.py
@@ -36,15 +36,21 @@
resource = urlopen(url)
for line in resource:
- line = line.rstrip()
+ line = line.decode('utf-8').rstrip()
if line.startswith('//') or '.' not in line:
continue
+
if line.startswith('*.'):
- suffixes[line[2:]] = 2
+ offset = 2
+ val = 2
elif line.startswith('!'):
- suffixes[line[1:]] = 0
+ offset = 1
+ val = 0
else:
- suffixes[line] = 1
+ offset = 0
+ val = 1
+
+ suffixes[line[offset:].encode('idna').decode('ascii')] = val
return suffixes
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld