Coerce submitted branch name from unicode to bytes.

I hit this in prod on the latest 1.3.4 release.
This commit is contained in:
Ralph Bean
2017-03-13 14:48:51 -04:00
parent 589a011582
commit 20671748ca

View File

@@ -133,6 +133,10 @@ class ModuleBuildAPI(MethodView):
branch = r["branch"]
# python-modulemd expects this to be bytes, not unicode.
if isinstance(branch, unicode):
branch = branch.encode('utf-8')
validate_optional_params(r)
optional_params = {k: v for k, v in r.items() if k != "scmurl" and k != 'branch'}
return submit_module_build_from_scm(username, url, branch, allow_local_url=False, optional_params=optional_params)