Skip to content

Commit ae97254

Browse files
authored
Merge pull request Azure#10328 from wastoresh/filehandle_fix
[Storage] Skip File/FileDir check when deal with file handle - Master
2 parents 76a76ff + 38517f6 commit ae97254

File tree

3 files changed

+9
-36
lines changed

3 files changed

+9
-36
lines changed

src/Storage/Storage.Management/ChangeLog.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@
2121
* Support enable Large File share when create or update Storage account
2222
- New-AzStorageAccount
2323
- Set-AzStorageAccount
24+
* When close/get File handle, skip check the input path is File directory or File, to avoid failure with object in DeletePending status
25+
- Get-AzStorageFileHandle
26+
- Close-AzStorageFileHandle
2427

2528
## Version 1.8.0
2629
* Upgrade Storage Client Library to 11.1.0

src/Storage/Storage/File/Cmdlet/CloseAzureStorageFileHandle.cs

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -213,24 +213,9 @@ public override void ExecuteCmdlet()
213213
string[] subfolders = NamingUtil.ValidatePath(this.Path);
214214
targetDir = baseDirectory.GetDirectoryReferenceByPath(subfolders);
215215

216-
if (!targetDir.Exists())
217-
{
218-
foundAFolder = false;
219-
}
220-
221-
if (!foundAFolder)
222-
{
223-
//Get file
224-
string[] filePath = NamingUtil.ValidatePath(this.Path, true);
225-
targetFile = baseDirectory.GetFileReferenceByPath(filePath);
226-
227-
this.Channel.FetchFileAttributesAsync(
228-
targetFile,
229-
null,
230-
this.RequestOptions,
231-
this.OperationContext,
232-
this.CmdletCancellationToken).ConfigureAwait(false);
233-
}
216+
// Don't need check the path target to File or FileDir since:
217+
// 1. check File/FileDir exist will fail on File/FileDir with DeletePending status
218+
// 2. The File handle request send with CloudFileDirectory and CloudFile are same with same path, so need to differ it.
234219
}
235220
}
236221

src/Storage/Storage/File/Cmdlet/GetAzureStorageFileHandle.cs

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -119,24 +119,9 @@ public override void ExecuteCmdlet()
119119
string[] subfolders = NamingUtil.ValidatePath(this.Path);
120120
targetDir = baseDirectory.GetDirectoryReferenceByPath(subfolders);
121121

122-
if (!targetDir.Exists())
123-
{
124-
foundAFolder = false;
125-
}
126-
127-
if (!foundAFolder)
128-
{
129-
//Get file
130-
string[] filePath = NamingUtil.ValidatePath(this.Path, true);
131-
targetFile = baseDirectory.GetFileReferenceByPath(filePath);
132-
133-
this.Channel.FetchFileAttributesAsync(
134-
targetFile,
135-
null,
136-
this.RequestOptions,
137-
this.OperationContext,
138-
this.CmdletCancellationToken).ConfigureAwait(false);
139-
}
122+
// Don't need check the path target to File or FileDir since:
123+
// 1. check File/FileDir exist will fail on File/FileDir with DeletePending status
124+
// 2. The File handle request send with CloudFileDirectory and CloudFile are same with same path, so need to differ it.
140125
}
141126
}
142127

0 commit comments

Comments
 (0)