Skip to content

Stg102/create file with data#48164

Open
browndav-msft wants to merge 6 commits intoAzure:mainfrom
browndav-msft:stg102/createFileWithData
Open

Stg102/create file with data#48164
browndav-msft wants to merge 6 commits intoAzure:mainfrom
browndav-msft:stg102/createFileWithData

Conversation

@browndav-msft
Copy link
Member

Readding the feature that was pulled from STG100

* bump latest service version from 2026_04_06 to 2026_06_06 for stg102

* refactor transformutils to use switch

* made changes based on comments
@github-actions github-actions bot added the Storage Storage Service (Queues, Blobs, Files) label Feb 27, 2026
- filePropertySemantics was not getting passed as an arg for the function in ShareDirectoryClient or ShareDirectoryAsyncClient
- created recordings for the new tests
@browndav-msft browndav-msft marked this pull request as ready for review March 3, 2026 23:28
Copilot AI review requested due to automatic review settings March 3, 2026 23:28
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Reintroduces the “create file with initial content” and “file property semantics” support (previously pulled) for Azure Storage File Share, while also bumping storage service versions to 2026-06-06 across related modules.

Changes:

  • Add filePropertySemantics and BinaryData payload support back into ShareFileCreateOptions and wire it through sync/async create calls.
  • Add filePropertySemantics support back into ShareDirectoryCreateOptions and wire it through sync/async create calls.
  • Update service version enums/defaults/tests to 2026-06-06 and re-enable the previously pulled tests.

Reviewed changes

Copilot reviewed 19 out of 19 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/QueueServiceVersion.java Add 2026-06-06 service version and set it as latest.
sdk/storage/azure-storage-file-share/src/test/java/com/azure/storage/file/share/FileAsyncApiTests.java Re-enable async tests for create-with-data and property semantics; bump required version.
sdk/storage/azure-storage-file-share/src/test/java/com/azure/storage/file/share/FileApiTests.java Re-enable sync tests for create-with-data and property semantics; bump required version.
sdk/storage/azure-storage-file-share/src/test/java/com/azure/storage/file/share/DirectoryAsyncApiTests.java Re-enable async directory tests for property semantics; bump required version.
sdk/storage/azure-storage-file-share/src/test/java/com/azure/storage/file/share/DirectoryApiTests.java Re-enable sync directory tests for property semantics; bump required version.
sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/options/ShareFileCreateOptions.java Restore filePropertySemantics + BinaryData fields and accessors.
sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/options/ShareDirectoryCreateOptions.java Restore filePropertySemantics field and accessors.
sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/ShareServiceVersion.java Add 2026-06-06 service version and set it as latest.
sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/ShareFileClient.java Wire filePropertySemantics + initial data into sync create request.
sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/ShareFileAsyncClient.java Wire filePropertySemantics + initial data into async create request and MD5 handling.
sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/ShareDirectoryClient.java Wire filePropertySemantics into sync directory create request.
sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/ShareDirectoryAsyncClient.java Wire filePropertySemantics into async directory create requests.
sdk/storage/azure-storage-file-share/assets.json Update assets tag reference.
sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/implementation/util/TransformUtils.java Refactor version conversion logic and add 2026-06-06 mapping.
sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/DataLakeServiceVersion.java Add 2026-06-06 service version and set it as latest.
sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/implementation/UploadUtils.java Restore sync computeMd5(ByteBuffer, ...) helper.
sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/implementation/Constants.java Bump default SAS service version/target version string to 2026-06-06.
sdk/storage/azure-storage-common/ci.system.properties Update CI system properties to use 2026-06-06.
sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobServiceVersion.java Add 2026-06-06 service version and set it as latest.

smbPropertiesLocal.getFileChangeTimeString(), requestConditionsLocal.getLeaseId(),
filePosixPropertiesLocal.getOwner(), filePosixPropertiesLocal.getGroup(),
filePosixPropertiesLocal.getFileMode(), filePosixPropertiesLocal.getFileType(), fluxMD5wrapper.getMd5(),
filePropertySemantics, contentLength, binaryData != null ? binaryData.toFluxByteBuffer() : null,
Copy link

Copilot AI Mar 3, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This computes MD5 from binaryData.toFluxByteBuffer() and then separately passes binaryData.toFluxByteBuffer() as the request body. That results in multiple reads/subscriptions of the underlying content and can break for non-replayable BinaryData (or produce a Content-MD5 that doesn't match the uploaded bytes). Prefer materializing/replaying the data once (e.g., make it replayable first) and then use the same data source for both MD5 computation and the request body.

Suggested change
filePropertySemantics, contentLength, binaryData != null ? binaryData.toFluxByteBuffer() : null,
filePropertySemantics, contentLength, fluxMD5wrapper.getFlux(),

Copilot uses AI. Check for mistakes.
Comment on lines 211 to 224
@@ -215,31 +217,31 @@ public FilePropertySemantics getFilePropertySemantics() {
*
* @param filePropertySemantics {@link FilePropertySemantics}
* @return The updated options.

*/
public ShareFileCreateOptions setFilePropertySemantics(FilePropertySemantics filePropertySemantics) {
this.filePropertySemantics = filePropertySemantics;
return this;
}
Copy link

Copilot AI Mar 3, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

setFilePropertySemantics is a public API but its comment is a non-Javadoc block (/* ... */). This breaks consistency with the rest of the options class and may omit it from generated API docs. Please convert it to proper JavaDoc (/** ... */).

Copilot uses AI. Check for mistakes.
Comment on lines 236 to +246
/*
* Optional, valid for version 2026-02-06 and later.
* Sets the content to upload to the file when it is created. Must be less than or equal to 4 MiB in size.
*
* @param binaryData The {@link BinaryData}.
* @return The updated options.

*/
public ShareFileCreateOptions setData(BinaryData binaryData) {
this.binaryData = binaryData;
return this;
} */
}
Copy link

Copilot AI Mar 3, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

setData is a public API but its comment is a non-Javadoc block (/* ... */). Please convert it to JavaDoc (/** ... */) so it appears in generated API docs and matches the style of the other setters in this class.

Copilot uses AI. Check for mistakes.
Comment on lines +151 to 157
/**
*
* @param data The data.
* @param logger Logger to log errors.
* @return The md5 of the data.
*/
public static byte[] computeMd5(ByteBuffer data, ClientLogger logger) {
Copy link

Copilot AI Mar 3, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The JavaDoc for computeMd5(ByteBuffer, ClientLogger) is missing a summary sentence (it starts with a blank *). Please add a brief description (for example, that it computes the MD5 of the provided buffer) to align with JavaDoc conventions and avoid doclint warnings.

Copilot uses AI. Check for mistakes.
Comment on lines 544 to +562
@@ -549,16 +549,17 @@ public Response<ShareFileInfo> createWithResponse(ShareFileCreateOptions options
} else {
contentLength = null;
contentMD5 = null;
} */
}

Callable<ResponseBase<FilesCreateHeaders, Void>> operation = () -> this.azureFileStorageClient.getFiles()
.createWithResponse(shareName, filePath, options.getSize(), null, options.getMetadata(),
options.getFilePermission(), options.getFilePermissionFormat(), smbProperties.getFilePermissionKey(),
smbProperties.getNtfsFileAttributesString(), smbProperties.getFileCreationTimeString(),
smbProperties.getFileLastWriteTimeString(), smbProperties.getFileChangeTimeString(),
requestConditions.getLeaseId(), fileposixProperties.getOwner(), fileposixProperties.getGroup(),
fileposixProperties.getFileMode(), fileposixProperties.getFileType(), null, null, null, null,
options.getShareFileHttpHeaders(), finalContext);
fileposixProperties.getFileMode(), fileposixProperties.getFileType(), contentMD5,
options.getFilePropertySemantics(), contentLength, options.getData(), options.getShareFileHttpHeaders(),
finalContext);
Copy link

Copilot AI Mar 3, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When options.getData() is set, this computes MD5 from options.getData().toByteBuffer() but then sends the original BinaryData in the request. If the BinaryData isn't replayable (or is backed by a one-shot source), the bytes used for the MD5 may not match the bytes actually sent (or the body may be empty on the second read). Consider first converting to a replayable BinaryData (and using that instance for both MD5/length and the request body), or explicitly validating replayability and failing fast.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Storage Storage Service (Queues, Blobs, Files)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants