diff --git a/swift/common/middleware/acl.py b/swift/common/middleware/acl.py index c23e89284c..8333bbab67 100644 --- a/swift/common/middleware/acl.py +++ b/swift/common/middleware/acl.py @@ -14,6 +14,8 @@ # limitations under the License. import json +import six +from six.moves.urllib.parse import unquote from swift.common.utils import urlparse @@ -200,7 +202,7 @@ def parse_acl_v1(acl_string): if value.startswith('.r:'): referrers.append(value[len('.r:'):]) else: - groups.append(value) + groups.append(unquote(value)) return referrers, groups @@ -293,8 +295,13 @@ def acls_from_account_info(info): readonly_members = acl.get('read-only', []) if not any((admin_members, readwrite_members, readonly_members)): return None - return { + + acls = { 'admin': admin_members, 'read-write': readwrite_members, 'read-only': readonly_members, } + if six.PY2: + for k in ('admin', 'read-write', 'read-only'): + acls[k] = [v.encode('utf8') for v in acls[k]] + return acls