public void DeleteObjectsWithHiddenCharacters()
{
char[] buffer = new char[2];
buffer[0] = Convert.ToChar(0x1c);
buffer[1] = Convert.ToChar(0x1a);
var newKey1 = _keyName + (new string(buffer)) + ".1.cd";
var newKey2 = _keyName + (new string(buffer)) + ".2.cd";
var newKey3 = _keyName + ".3.cd";
try
{
_ossClient.PutObject(_bucketName, newKey1, Config.UploadTestFile);
_ossClient.PutObject(_bucketName, newKey2, Config.UploadTestFile);
_ossClient.PutObject(_bucketName, newKey3, Config.UploadTestFile);
Assert.IsTrue(OssTestUtils.ObjectExists(_ossClient, _bucketName, newKey1));
Assert.IsTrue(OssTestUtils.ObjectExists(_ossClient, _bucketName, newKey2));
Assert.IsTrue(OssTestUtils.ObjectExists(_ossClient, _bucketName, newKey3));
var keys = new List<string>();
keys.Add(newKey1);
keys.Add(newKey2);
keys.Add(newKey3);
var request = new DeleteObjectsRequest(_bucketName, keys);
_ossClient.DeleteObjects(request);
Assert.IsFalse(OssTestUtils.ObjectExists(_ossClient, _bucketName, newKey1));
Assert.IsFalse(OssTestUtils.ObjectExists(_ossClient, _bucketName, newKey2));
Assert.IsFalse(OssTestUtils.ObjectExists(_ossClient, _bucketName, newKey3));
}
finally
{
_ossClient.DeleteObject(_bucketName, newKey1);
_ossClient.DeleteObject(_bucketName, newKey2);
_ossClient.DeleteObject(_bucketName, newKey3);
}
}