@@ -22,7 +22,6 @@ namespace Microsoft.WindowsAzure.Commands.Storage.File.Cmdlet
2222 using Microsoft . Azure . Storage . DataMovement ;
2323 using Microsoft . Azure . Storage . File ;
2424 using Microsoft . WindowsAzure . Commands . Common ;
25- using Microsoft . WindowsAzure . Commands . Common . CustomAttributes ;
2625 using Microsoft . WindowsAzure . Commands . Common . Storage . ResourceModel ;
2726 using Microsoft . WindowsAzure . Commands . Storage . Common ;
2827 using Microsoft . WindowsAzure . Commands . Utilities . Common ;
@@ -37,7 +36,6 @@ namespace Microsoft.WindowsAzure.Commands.Storage.File.Cmdlet
3736 using System . Threading . Tasks ;
3837 using LocalConstants = Microsoft . WindowsAzure . Commands . Storage . File . Constants ;
3938
40- [ CmdletOutputBreakingChangeWithVersion ( typeof ( AzureStorageFile ) , "14.0.0" , "9.0.0" , ChangeDescription = "The ContentHash properties will be removed from the uploaded Azure file when file size > 1TB, or upload with Oauth credencial, or with -DisAllowTrailingDot." ) ]
4139 [ Cmdlet ( "Set" , Azure . Commands . ResourceManager . Common . AzureRMConstants . AzurePrefix + "StorageFileContent" , SupportsShouldProcess = true , DefaultParameterSetName = LocalConstants . ShareNameParameterSetName ) , OutputType ( typeof ( AzureStorageFile ) ) ]
4240 public class SetAzureStorageFileContent : StorageFileDataManagementCmdletBase , IDynamicParameters
4341 {
@@ -130,17 +128,9 @@ public override void ExecuteCmdlet()
130128 }
131129 long fileSize = localFile . Length ;
132130
133- // if FIPS policy is enabled, must use native MD5 for DMlib.
134- if ( fipsEnabled )
131+ if ( RuntimeInformation . IsOSPlatform ( OSPlatform . Windows ) )
135132 {
136- if ( fileSize < sizeTB )
137- {
138- CloudStorageAccount . UseV1MD5 = false ;
139- }
140- else // use Track2 SDK
141- {
142- WriteWarning ( "The uploaded file won't have Content MD5 hash, since caculate MD5 hash fail, most possiblly caused by FIPS is enabled on this machine." ) ;
143- }
133+ CloudStorageAccount . UseV1MD5 = false ;
144134 }
145135
146136 bool isDirectory ;
@@ -251,12 +241,6 @@ await fileClient.CreateAsync(fileSize,
251241
252242 List < Task > runningTasks = new List < Task > ( ) ;
253243
254- IncrementalHash hash = null ;
255- if ( ! fipsEnabled )
256- {
257- hash = IncrementalHash . CreateHash ( HashAlgorithmName . MD5 ) ;
258- }
259-
260244 using ( FileStream stream = File . OpenRead ( localFile . FullName ) )
261245 {
262246 byte [ ] buffer = null ;
@@ -268,10 +252,6 @@ await fileClient.CreateAsync(fileSize,
268252 buffer = new byte [ targetBlockSize ] ;
269253
270254 int actualBlockSize = await stream . ReadAsync ( buffer : buffer , offset : 0 , count : ( int ) targetBlockSize ) ;
271- if ( ! fipsEnabled && hash != null )
272- {
273- hash . AppendData ( buffer , 0 , actualBlockSize ) ;
274- }
275255
276256 Task task = UploadFileRangAsync ( fileClient ,
277257 new HttpRange ( offset , actualBlockSize ) ,
@@ -305,24 +285,6 @@ await fileClient.CreateAsync(fileSize,
305285 await Task . WhenAll ( runningTasks ) . ConfigureAwait ( false ) ;
306286 }
307287
308- // Need set file ContentHash
309- if ( ( ! fipsEnabled && hash != null ) )
310- {
311- ShareFileHttpHeaders header = null ;
312- if ( ! fipsEnabled && hash != null )
313- {
314- header = new ShareFileHttpHeaders ( ) ;
315- header . ContentHash = hash . GetHashAndReset ( ) ;
316- }
317-
318- // set file header and attributes to the file
319- ShareFileSetHttpHeadersOptions httpHeadersOptions = new ShareFileSetHttpHeadersOptions
320- {
321- HttpHeaders = header ,
322- } ;
323- fileClient . SetHttpHeaders ( httpHeadersOptions ) ;
324- }
325-
326288 if ( this . PassThru )
327289 {
328290 // TODO: should make sure track1 file object attributes get?
0 commit comments