Ensure that identity token in header is not an unicode string

We need all the headers to be safe strings so they can be joined
together and not become an unicode string in doing so.

This fixes a bug when creating an image with non-ascii characters in the
name.

This is required for python 2.6 compatibility.

Change-Id: I66ebc27edf4ccd8f903399da58705711c372536d
Closes-Bug: 1448080
This commit is contained in:
Vincent Untz
2015-04-24 13:29:12 +02:00
parent d91210c806
commit f65ba82268
4 changed files with 14 additions and 4 deletions
+1 -2
View File
@@ -449,8 +449,7 @@ def memoized_property(fn):
def safe_header(name, value):
if value is not None and name in SENSITIVE_HEADERS:
v = value.encode('utf-8')
h = hashlib.sha1(v)
h = hashlib.sha1(value)
d = h.hexdigest()
return name, "{SHA1}%s" % d
else: