From 3265e89fd30bd891c1fbc97b6a343422f709f506 Mon Sep 17 00:00:00 2001 From: Brian Pandola Date: Thu, 27 May 2021 00:44:20 -0700 Subject: [PATCH] Allow Glacier VaultName to contain period (#3964) --- moto/glacier/urls.py | 2 +- tests/test_glacier/test_glacier_vaults.py | 11 ++++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/moto/glacier/urls.py b/moto/glacier/urls.py index 480b125af..85a64881a 100644 --- a/moto/glacier/urls.py +++ b/moto/glacier/urls.py @@ -5,7 +5,7 @@ url_bases = ["https?://glacier.(.+).amazonaws.com"] url_paths = { "{0}/(?P.+)/vaults$": GlacierResponse.all_vault_response, - "{0}/(?P.+)/vaults/(?P[^/.]+)$": GlacierResponse.vault_response, + "{0}/(?P.+)/vaults/(?P[^/]+)$": GlacierResponse.vault_response, "{0}/(?P.+)/vaults/(?P.+)/archives$": GlacierResponse.vault_archive_response, "{0}/(?P.+)/vaults/(?P.+)/archives/(?P.+)$": GlacierResponse.vault_archive_individual_response, "{0}/(?P.+)/vaults/(?P.+)/jobs$": GlacierResponse.vault_jobs_response, diff --git a/tests/test_glacier/test_glacier_vaults.py b/tests/test_glacier/test_glacier_vaults.py index 93c79423e..1964b52db 100644 --- a/tests/test_glacier/test_glacier_vaults.py +++ b/tests/test_glacier/test_glacier_vaults.py @@ -1,9 +1,10 @@ from __future__ import unicode_literals import boto.glacier +import boto3 import sure # noqa -from moto import mock_glacier_deprecated +from moto import mock_glacier_deprecated, mock_glacier @mock_glacier_deprecated @@ -29,3 +30,11 @@ def test_delete_vault(): conn.delete_vault("my_vault") vaults = conn.list_vaults() vaults.should.have.length_of(0) + + +@mock_glacier +def test_vault_name_with_special_characters(): + vault_name = "Vault.name-with_Special.characters" + glacier = boto3.resource("glacier", region_name="us-west-2") + vault = glacier.create_vault(accountId="-", vaultName=vault_name) + vault.name.should.equal(vault_name)