Skip to content

Commit 104d438

Browse files
authored
Merge pull request #5916 from wastoresh/webcontainer
[Storage] Support $web Container
2 parents 77019f4 + 8e38172 commit 104d438

File tree

3 files changed

+12
-6
lines changed

3 files changed

+12
-6
lines changed

src/Storage/ChangeLog.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@
1818
- Additional information about change #1
1919
-->
2020
## Current Release
21+
*Support $web as Storage blob container name
22+
- New-AzureStorageBlobContainer
23+
- Remove-AzureStorageBlobContainer
24+
- Set-AzureStorageBlobContent
25+
- Get-AzureStorageBlobContent
2126

2227
## Version 4.2.1
2328
* Fix the issue that upload Blob and upload File cmdlets fail on FIPS policy enabled machines

src/Storage/Commands.Storage.Test/Common/NameUtilTest.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public class NameUtilTest : StorageTestBase
2727
[TestMethod]
2828
public void IsValidContainerNameTest()
2929
{
30-
string[] positives = { "$root", "$logs", "abc", "abc987", "abc2de", "4abc", "abc-def", new String('a', 63) };
30+
string[] positives = { "$root", "$logs", "$web", "abc", "abc987", "abc2de", "4abc", "abc-def", new String('a', 63) };
3131
NameValidateHelper(positives, true, NameUtil.IsValidContainerName);
3232

3333
string[] negatives =
@@ -51,7 +51,7 @@ public void IsValidContainerNameTest()
5151
[TestMethod]
5252
public void IsValidContainerPrefixTest()
5353
{
54-
string[] positives = { "$", "$ro", "$l", "$root", "a", "ab", "abc", "$logs", "abc", "abc987", "abc2de", "4abc", "abc-def", "a-c", "ac-", new String('a', 63) };
54+
string[] positives = { "$", "$ro", "$l", "$root", "a", "ab", "abc", "$logs", "$web", "abc", "abc987", "abc2de", "4abc", "abc-def", "a-c", "ac-", new String('a', 63) };
5555
NameValidateHelper(positives, true, NameUtil.IsValidContainerPrefix);
5656

5757
string[] negatives =
@@ -74,7 +74,7 @@ public void IsValidContainerPrefixTest()
7474
[TestMethod]
7575
public void IsValidBlobNameTest()
7676
{
77-
string[] positives = { "$", "$ro", "$l", "$root", "a", "*&(&^$^*", "ab", "abc", "$logs", "abc", "abc987", "abc2de", "4abc", "abc-def", "a-c", "ac-", new String('a', 1024)};
77+
string[] positives = { "$", "$ro", "$l", "$root", "a", "*&(&^$^*", "ab", "abc", "$logs", "$web", "abc", "abc987", "abc2de", "4abc", "abc-def", "a-c", "ac-", new String('a', 1024)};
7878
NameValidateHelper(positives, true, NameUtil.IsValidBlobName);
7979

8080
string[] negatives =
@@ -88,7 +88,7 @@ public void IsValidBlobNameTest()
8888
[TestMethod]
8989
public void IsValidBlobPrefixTest()
9090
{
91-
string[] positives = { "$", "$ro", "$l", "$root", "a", "*&(&^$^*", "ab", "abc", "$logs", "abc", "abc987", "abc2de", "4abc", "abc-def", "a-c", "ac-", new String('a', 1024) };
91+
string[] positives = { "$", "$ro", "$l", "$root", "a", "*&(&^$^*", "ab", "abc", "$logs", "$web", "abc", "abc987", "abc2de", "4abc", "abc-def", "a-c", "ac-", new String('a', 1024) };
9292
NameValidateHelper(positives, true, NameUtil.IsValidBlobPrefix);
9393

9494
string[] negatives =

src/Storage/Commands.Storage/Common/NameUtil.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ public static void ValidateContainerName(string name)
7373
/// <returns>True for valid container name, otherwise return false</returns>
7474
public static bool IsValidContainerName(string containerName)
7575
{
76-
Regex regex = new Regex(@"^\$root$|^\$logs$|^[a-z0-9]([a-z0-9]|(?<=[a-z0-9])-(?=[a-z0-9])){2,62}$");
76+
Regex regex = new Regex(@"^\$root$|^\$logs$|^\$web$|^[a-z0-9]([a-z0-9]|(?<=[a-z0-9])-(?=[a-z0-9])){2,62}$");
7777
return regex.IsMatch(containerName);
7878
}
7979

@@ -88,8 +88,9 @@ public static bool IsValidContainerPrefix(string containerPrefix)
8888
{
8989
string root = "$root";
9090
string logs = "$logs";
91+
string web = "$web";
9192

92-
if (root.IndexOf(containerPrefix) == 0 || logs.IndexOf(containerPrefix) == 0)
93+
if (root.IndexOf(containerPrefix) == 0 || logs.IndexOf(containerPrefix) == 0 || web.IndexOf(containerPrefix) == 0)
9394
{
9495
return true;
9596
}

0 commit comments

Comments
 (0)