From 6173c79490d0ac4a969449a7410f659ff47583c3 Mon Sep 17 00:00:00 2001 From: Carlo Bertini Date: Wed, 20 Jun 2018 08:15:13 +0000 Subject: [PATCH] fix set_bucket_notification filter (#660) --- minio/xml_marshal.py | 2 +- tests/unit/set_bucket_notification_test.py | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/minio/xml_marshal.py b/minio/xml_marshal.py index 9c62aa0eb..465e4b01d 100644 --- a/minio/xml_marshal.py +++ b/minio/xml_marshal.py @@ -185,7 +185,7 @@ def _add_notification_config_to_xml(node, element_name, configs): event_node = s3_xml.SubElement(config_node, 'Event') event_node.text = event - filter_rules = config_node.get('Filter', {}).get( + filter_rules = config.get('Filter', {}).get( 'Key', {}).get('FilterRules', []) if filter_rules: filter_node = s3_xml.SubElement(config_node, 'Filter') diff --git a/tests/unit/set_bucket_notification_test.py b/tests/unit/set_bucket_notification_test.py index a715adbab..11562e5a2 100644 --- a/tests/unit/set_bucket_notification_test.py +++ b/tests/unit/set_bucket_notification_test.py @@ -305,9 +305,9 @@ def test_notification_config_filterspec_is_valid_7(self, mock_connection): 'PUT', 'https://localhost:9000/my-test-bucket/?notification=', { - 'Content-Md5': 'AGCNfbD5OuiyIJFd+r67MA==', + 'Content-Md5': 'k97dHBBUq9MR7ZViy7oUsw==', 'User-Agent': _DEFAULT_USER_AGENT, - 'Content-Length': '206', + 'Content-Length': '300', }, 200, content="" ) @@ -345,8 +345,8 @@ def test_notification_config_filterspec_is_valid_8(self, mock_connection): 'PUT', 'https://localhost:9000/my-test-bucket/?notification=', { - 'Content-Length': '206', - 'Content-Md5': 'AGCNfbD5OuiyIJFd+r67MA==', + 'Content-Length': '300', + 'Content-Md5': '2aIwAt1lAd5JShphHCD4GA==', 'User-Agent': _DEFAULT_USER_AGENT, }, 200, content=""