diff options
author | Mike Frysinger <vapier@google.com> | 2019-11-15 01:19:03 -0500 |
---|---|---|
committer | Mike Frysinger <vapier@google.com> | 2019-11-16 23:55:30 +0000 |
commit | 70c54dc2550084ed022a2f134065a011f37f30aa (patch) | |
tree | 6086cb67a1b1f928892b4d47d1b77a069b5ae31f /subcmds/upload.py | |
parent | 6da17751ca4e3b90834ca763f448ddc39b32651b (diff) | |
download | git-repo-70c54dc2550084ed022a2f134065a011f37f30aa.tar.gz |
upload/editor: fix bytes/string confusion
The upload module tries to turn the strings into bytes before passing
to EditString, but it combines bytes & strings causing an error. The
return value might be bytes or string, but the caller only expects a
string. Lets simplify this by sticking to strings everywhere and have
EditString take care of converting to/from bytes when reading/writing
the underlying files. This also avoids possible locale confusion when
reading the file by forcing UTF-8 everywhere.
Bug: https://crbug.com/gerrit/11929
Change-Id: I07b146170c5e8b5b0500a2c79e4213cd12140a96
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/245621
Reviewed-by: David Pursehouse <dpursehouse@collab.net>
Tested-by: Mike Frysinger <vapier@google.com>
Diffstat (limited to 'subcmds/upload.py')
-rw-r--r-- | subcmds/upload.py | 5 |
1 files changed, 0 insertions, 5 deletions
diff --git a/subcmds/upload.py b/subcmds/upload.py index d0dd3837..5c12aaee 100644 --- a/subcmds/upload.py +++ b/subcmds/upload.py | |||
@@ -271,11 +271,6 @@ Gerrit Code Review: https://www.gerritcodereview.com/ | |||
271 | branches[project.name] = b | 271 | branches[project.name] = b |
272 | script.append('') | 272 | script.append('') |
273 | 273 | ||
274 | script = [ x.encode('utf-8') | ||
275 | if issubclass(type(x), unicode) | ||
276 | else x | ||
277 | for x in script ] | ||
278 | |||
279 | script = Editor.EditString("\n".join(script)).split("\n") | 274 | script = Editor.EditString("\n".join(script)).split("\n") |
280 | 275 | ||
281 | project_re = re.compile(r'^#?\s*project\s*([^\s]+)/:$') | 276 | project_re = re.compile(r'^#?\s*project\s*([^\s]+)/:$') |