-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixed storage bug where blob, file, and directory names were not url … #11657
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -61,6 +61,28 @@ public void Ctor_ConnectionString() | |
Assert.AreEqual("accountName", builder2.AccountName); | ||
} | ||
|
||
[Test] | ||
[Ignore("Test framework doesn't allow recorded tests with connection string because the word 'Sanitized' is not base-64 encoded, so we can't pass connection string validation")] | ||
public async Task Ctor_ConnectionStringEscapeBlobName() | ||
{ | ||
// Arrange | ||
await using DisposingContainer test = await GetTestContainerAsync(); | ||
string blobName = "!*'();[]:@&%=+$,/?#"; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As far as I recall (@rickle-msft plz chime in if I'm wrong here) @rickle-msft was/is chasing a bug in Java where German Umlauts got encoded with different target encoding (turns out Url encoding/percent encoding has target encoding...) than expected by server side. Might be worth adding that to test case suite. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. what's target encoding? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Here's the PR where this was addressed in Java. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added German characters to all the new tests, they are still passing. |
||
|
||
BlockBlobClient initalBlob = InstrumentClient(test.Container.GetBlockBlobClient(blobName)); | ||
var data = GetRandomBuffer(Constants.KB); | ||
|
||
using var stream = new MemoryStream(data); | ||
Response<BlobContentInfo> uploadResponse = await initalBlob.UploadAsync(stream); | ||
|
||
// Act | ||
BlobBaseClient blob = new BlobBaseClient(TestConfigDefault.ConnectionString, test.Container.Name, blobName, GetOptions()); | ||
Response<BlobProperties> propertiesResponse = await blob.GetPropertiesAsync(); | ||
|
||
// Assert | ||
Assert.AreEqual(uploadResponse.Value.ETag, propertiesResponse.Value.ETag); | ||
} | ||
|
||
[Test] | ||
public void Ctor_Uri() | ||
{ | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -50,6 +50,31 @@ public void Ctor_ConnectionString() | |
//Assert.AreEqual("accountName", builder.AccountName); | ||
} | ||
|
||
[Test] | ||
[Ignore("Test framework doesn't allow recorded tests with connection string because the word 'Sanitized' is not base-64 encoded, so we can't pass connection string validation")] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can this be "Live" as well ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done, my bad. |
||
public async Task Ctor_ConnectionStringEscapePath() | ||
{ | ||
// Arrange | ||
await using DisposingShare test = await GetTestShareAsync(); | ||
string directoryName = "!#@&=;"; | ||
string fileName = "#$=;!"; | ||
ShareDirectoryClient directory = InstrumentClient(test.Share.GetDirectoryClient(directoryName)); | ||
await directory.CreateAsync(); | ||
ShareFileClient initalFile = InstrumentClient(directory.GetFileClient(fileName)); | ||
Response<ShareFileInfo> createResponse = await initalFile.CreateAsync(Constants.KB); | ||
|
||
// Act | ||
ShareFileClient file = new ShareFileClient( | ||
TestConfigDefault.ConnectionString, | ||
test.Share.Name, | ||
$"{directoryName}/{fileName}", | ||
GetOptions()); | ||
Response<ShareFileProperties> propertiesResponse = await file.GetPropertiesAsync(); | ||
|
||
// Assert | ||
Assert.AreEqual(createResponse.Value.ETag, propertiesResponse.Value.ETag); | ||
} | ||
|
||
[Test] | ||
public void FilePathsParsing() | ||
{ | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be Live test then ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.