mirror of
https://chromium.googlesource.com/chromium/tools/depot_tools.git
synced 2026-01-11 10:41:31 +00:00
depot_tools: Fix bug when running download_from_google on Python 3.
Issue caused by utf-8 vs byte mismatch in python 3. Bug: 1009698 Change-Id: I8ab6b129ea9ab18f06f8ff4eb5da3aa018829365 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1832773 Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org> Reviewed-by: Anthony Polito <apolito@google.com>
This commit is contained in:
@@ -175,7 +175,7 @@ def enumerate_input(input_filename, directory, recursive, ignore_errors, output,
|
||||
with open(input_filename, 'rb') as f:
|
||||
sha1_match = re.match(b'^([A-Za-z0-9]{40})$', f.read(1024).rstrip())
|
||||
if sha1_match:
|
||||
yield (sha1_match.groups(1)[0], output)
|
||||
yield (sha1_match.groups(1)[0].decode('utf-8'), output)
|
||||
return
|
||||
if not ignore_errors:
|
||||
raise InvalidFileError('No sha1 sum found in %s.' % input_filename)
|
||||
@@ -214,7 +214,10 @@ def enumerate_input(input_filename, directory, recursive, ignore_errors, output,
|
||||
with open(full_path, 'rb') as f:
|
||||
sha1_match = re.match(b'^([A-Za-z0-9]{40})$', f.read(1024).rstrip())
|
||||
if sha1_match:
|
||||
yield (sha1_match.groups(1)[0], full_path.replace('.sha1', ''))
|
||||
yield (
|
||||
sha1_match.groups(1)[0].decode('utf-8'),
|
||||
full_path.replace('.sha1', '')
|
||||
)
|
||||
else:
|
||||
if not ignore_errors:
|
||||
raise InvalidFileError('No sha1 sum found in %s.' % filename)
|
||||
|
||||
Reference in New Issue
Block a user