Skip to content

Commit 28a4587

Browse files
update mistake in change log and add ex. for create blob in directory (#46693)
* update mistake in change log and add example for blob client in directory * change / to %2F * add space * add space * add space * update readmesamples and updated readme files * remove comments from directory blob client creation * add space * copilot changed a readme in gh, but didn't change the samplesFile * update blob-crypto and datalake changelogs with clearer example
1 parent 5e2ecd0 commit 28a4587

5 files changed

Lines changed: 54 additions & 19 deletions

File tree

sdk/storage/azure-storage-blob-cryptography/CHANGELOG.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -152,10 +152,10 @@
152152

153153
### Breaking Changes
154154
- When creating a `EncryptedBlobClient` via EncryptedBlobClientBuilder, the blob name will be stored exactly as passed
155-
in and will not be URL-encoded. For example, if blob name is "test%25test" and is created by calling
156-
`EncryptedBlobClientBuilder.blobName("test%25test")` along with other required parameters,
157-
`EncryptedBlobClient.getBlobName()` will return "test%25test" and the blob's url will result in
158-
https://account.blob.core.windows.net/container/test%25%25test.
155+
in and will not be URL-encoded. For example, if blob name is "directory/blob.txt" and is created by calling
156+
`EncryptedBlobClientBuilder.blobName("directory/blob.txt")` along with other required parameters,
157+
`EncryptedBlobClient.getBlobName()` will return "directory/blob.txt" and the blob's url will result in
158+
https://account.blob.core.windows.net/container/directory%2Fblob.txt.
159159

160160
### Other Changes
161161

sdk/storage/azure-storage-blob/CHANGELOG.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -231,10 +231,10 @@
231231
### Breaking Changes
232232
- When creating a `BlobClient` via `BlobContainerClient.getBlobClient(String blobName)` or
233233
`BlobServiceClient.getBlobClient(String blobName)`, the blob name will be stored exactly as passed in and will not be
234-
URL-encoded. For example, if blob name is "test%25test" and is created by calling
235-
`BlobContainerClient.getBlobClient("test%25test")` or `BlobClient.getBlobName("test%25test")`,
236-
`BlobClient.getBlobName()` will return "test%25test" and the blob's url will result in
237-
https://account.blob.core.windows.net/container/test%25%25test”.
234+
URL-encoded. For example, if blob name is "directory/blob.txt" and is created by calling
235+
`BlobContainerClient.getBlobClient("directory/blob.txt")`,
236+
`BlobClient.getBlobName()` will return "directory/blob.txt" and the blob's url will result in
237+
https://account.blob.core.windows.net/container/directory%2Fblob.txt".
238238

239239
## 12.25.3 (2024-03-20)
240240

sdk/storage/azure-storage-blob/README.md

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ BlobClient blobClient = blobContainerClient.getBlobClient("myblob");
251251

252252
or
253253

254-
Create a `BlobClient` from the builder [`sasToken`](#get-credentials) generated above.
254+
Create a `BlobClient` within a directory structure using `BlobContainerClient`.
255255

256256
```java readme-sample-getBlobClient2
257257
BlobClient blobClient = new BlobClientBuilder()
@@ -264,8 +264,27 @@ BlobClient blobClient = new BlobClientBuilder()
264264

265265
or
266266

267+
Create a `BlobClient` from the builder [`sasToken`](#get-credentials) generated above.
268+
267269
```java readme-sample-getBlobClient3
268-
// Only one "?" is needed here. If the SAS token starts with "?", please removing one "?".
270+
BlobClient blobClient = blobContainerClient.getBlobClient("directory/myblob");
271+
```
272+
273+
or
274+
275+
```java readme-sample-getBlobClient4
276+
BlobClient blobClient = new BlobClientBuilder()
277+
.endpoint("<your-storage-account-url>")
278+
.sasToken("<your-sasToken>")
279+
.containerName("mycontainer")
280+
.blobName("directory/myblob")
281+
.buildClient();
282+
```
283+
284+
or
285+
286+
```java readme-sample-getBlobClient5
287+
// Only one "?" is needed here. If the SAS token starts with "?", please remove one "?".
269288
BlobClient blobClient = new BlobClientBuilder()
270289
.endpoint("<your-storage-account-url>" + "/" + "mycontainer" + "/" + "myblob" + "?" + "<your-sasToken>")
271290
.buildClient();

sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/ReadmeSamples.java

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -106,11 +106,28 @@ public void getBlobClient2() {
106106

107107
public void getBlobClient3() {
108108
// BEGIN: readme-sample-getBlobClient3
109-
// Only one "?" is needed here. If the SAS token starts with "?", please removing one "?".
109+
BlobClient blobClient = blobContainerClient.getBlobClient("directory/myblob");
110+
// END: readme-sample-getBlobClient3
111+
}
112+
113+
public void getBlobClient4() {
114+
// BEGIN: readme-sample-getBlobClient4
115+
BlobClient blobClient = new BlobClientBuilder()
116+
.endpoint("<your-storage-account-url>")
117+
.sasToken("<your-sasToken>")
118+
.containerName("mycontainer")
119+
.blobName("directory/myblob")
120+
.buildClient();
121+
// END: readme-sample-getBlobClient4
122+
}
123+
124+
public void getBlobClient5() {
125+
// BEGIN: readme-sample-getBlobClient5
126+
// Only one "?" is needed here. If the SAS token starts with "?", please remove one "?".
110127
BlobClient blobClient = new BlobClientBuilder()
111128
.endpoint("<your-storage-account-url>" + "/" + "mycontainer" + "/" + "myblob" + "?" + "<your-sasToken>")
112129
.buildClient();
113-
// END: readme-sample-getBlobClient3
130+
// END: readme-sample-getBlobClient5
114131
}
115132

116133
public void createBlobContainerClient1() {
@@ -379,4 +396,3 @@ public void setProxy2() {
379396
// END: readme-sample-setProxy2
380397
}
381398
}
382-

sdk/storage/azure-storage-file-datalake/CHANGELOG.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -187,9 +187,9 @@
187187
- When creating a `DataLakeFileClient` or `DataLakeDirectoryClient` via `DataLakeFileSystemClient.getDirectoryClient(String directoryName)`,
188188
`DataLakeFileSystemClient.getDirectoryClient(String fileName)`, `DataLakeDirectoryClient.getSubDirectoryClient(String blobName)`
189189
and `DataLakeDirectoryClient.getSubDirectoryClient(String blobName)`, the path name will be stored exactly as passed in
190-
and will not be URL-encoded. For example, if the path name is "test%25test" and is created by calling `DataLakeFileSystemClient.getDirectoryClient("test%25test")`,
191-
`DataLakeDirectoryClient.getDirectoryPath()` will return "test%25test" and the path's url will result in
192-
https://account.dfs.core.windows.net/filesystemname/test%25%25test.
190+
and will not be URL-encoded. For example, if the path name is "directory/blob.txt" and is created by calling `DataLakeFileSystemClient.getDirectoryClient("directory/blob.txt")`,
191+
`DataLakeDirectoryClient.getDirectoryPath()` will return "directory/blob.txt" and the path's url will result in
192+
https://account.dfs.core.windows.net/filesystemname/directory%2Fblob.txt.
193193

194194
### Bugs Fixed
195195
- Fixed a bug that did not allow uploading an empty 0 byte file with `DataLakeFileClient.uploadFromFile()`.
@@ -222,9 +222,9 @@
222222
- When creating a `DataLakeFileClient` or `DataLakeDirectoryClient` via `DataLakeFileSystemClient.getDirectoryClient(String directoryName)`,
223223
`DataLakeFileSystemClient.getDirectoryClient(String fileName)`, `DataLakeDirectoryClient.getSubDirectoryClient(String blobName)`
224224
and `DataLakeDirectoryClient.getSubDirectoryClient(String blobName)`, the path name will be stored exactly as passed in
225-
and will not be URL-encoded. For example, if the path name is "test%25test" and is created by calling `DataLakeFileSystemClient.getDirectoryClient("test%25test")`,
226-
`DataLakeDirectoryClient.getDirectoryPath()` will return "test%25test" and the path's url will result in
227-
https://account.dfs.core.windows.net/filesystemname/test%25%25test.
225+
and will not be URL-encoded. For example, if the path name is "directory/blob.txt" and is created by calling `DataLakeFileSystemClient.getDirectoryClient("directory/blob.txt")`,
226+
`DataLakeDirectoryClient.getDirectoryPath()` will return "directory/blob.txt" and the path's url will result in
227+
https://account.dfs.core.windows.net/filesystemname/directory%2Fblob.txt.
228228

229229
### Bugs Fixed
230230
- Fixed a bug that did not allow uploading an empty 0 byte file with `DataLakeFileClient.uploadFromFile()`.

0 commit comments

Comments
 (0)