diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 048c3878cdb8..39682429e5f2 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -8,6 +8,10 @@ Next Release (TBD) * feature:``aws cloudtrail``: Add support for regionalized policy templates for the ``create-subscription`` and ``update-subscription`` commands. (`issue 1167 `__) +* bugfix:parsing: Fix issue where if there is a square bracket inside one + of the values of a list, the end character would get removed. + (`issue 1183 `__) + 1.7.12 ====== diff --git a/awscli/utils.py b/awscli/utils.py index 84c17d69610f..9c86db041309 100644 --- a/awscli/utils.py +++ b/awscli/utils.py @@ -85,7 +85,7 @@ def _eat_items(value, iter_parts, part, end_char, replace_char=''): except StopIteration: raise ValueError(value) chunks.append(current.replace(replace_char, '')) - if end_char in current: + if current.endswith(end_char): break return ','.join(chunks) diff --git a/tests/unit/test_utils.py b/tests/unit/test_utils.py index 16d3eeb20484..20eabebeddb7 100644 --- a/tests/unit/test_utils.py +++ b/tests/unit/test_utils.py @@ -82,3 +82,7 @@ def test_missing_bracket2(self): def test_bracket_in_middle(self): self.assertEqual(split_on_commas('foo,bar=a[b][c],baz'), ['foo', 'bar=a[b][c]', 'baz']) + + def test_end_bracket_in_value(self): + self.assertEqual(split_on_commas('foo,bar=[foo,*[biz]*,baz]'), + ['foo', 'bar=foo,*[biz]*,baz'])