Skip to content

Commit 60d1133

Browse files
authored
Merge pull request #7878 from wastoresh/filcopycontext
[Storage] Fix Start-AzureStorageFileCopy can't resue source context in destination when not input -DestContext
2 parents 707f5f9 + c24ba1f commit 60d1133

File tree

2 files changed

+18
-6
lines changed

2 files changed

+18
-6
lines changed

src/Storage/Commands.Storage/ChangeLog.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
- Additional information about change #1
1919
-->
2020
## Current Release
21+
* Fix issue that Copy File cmdlet can't reuse source context in destination when not input -DestContext
22+
- Start-AzureStorageFileCopy
2123
* Support Static Website configuration
2224
- Enable-AzureStorageStaticWebsite
2325
- Disable-AzureStorageStaticWebsite

src/Storage/Commands.Storage/File/Cmdlet/StartAzureStorageFileCopy.cs

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -188,8 +188,6 @@ internal IStorageFileManagement GetDestinationChannel()
188188

189189
if (destChannel == null)
190190
{
191-
AzureStorageContext context = null;
192-
193191
if (ContainerNameParameterSet == this.ParameterSetName ||
194192
ContainerParameterSet == this.ParameterSetName ||
195193
BlobFilePathParameterSet == this.ParameterSetName ||
@@ -198,14 +196,26 @@ internal IStorageFileManagement GetDestinationChannel()
198196
FileFilePathParameterSet == this.ParameterSetName ||
199197
UriFilePathParameterSet == this.ParameterSetName)
200198
{
201-
context = this.GetCmdletStorageContext(DestContext);
199+
if (DestContext == null)
200+
{
201+
if (Channel != null)
202+
{
203+
destChannel = Channel;
204+
}
205+
else
206+
{
207+
destChannel = base.CreateChannel();
208+
}
209+
}
210+
else
211+
{
212+
destChannel = new StorageFileManagement(this.GetCmdletStorageContext(DestContext));
213+
}
202214
}
203215
else
204216
{
205-
context = AzureStorageContext.EmptyContextInstance;
217+
destChannel = base.CreateChannel();
206218
}
207-
208-
destChannel = new StorageFileManagement(context);
209219
}
210220

211221
return destChannel;

0 commit comments

Comments
 (0)