diff --git a/CHANGELOG.md b/CHANGELOG.md index 41f5b6892..9cb2705ae 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -127,7 +127,9 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/). - Removed `Add-PnPWorkflowDefinition`, `Add-PnPWorkflowSubscription`, `Get-PnPWorkflowDefinition`, `Get-PnPWorkflowInstances`, `Get-PnPWorkflowSubscription`, `Remove-PnPWorkflowDefinition`, `Remove-PnPWorkflowSubscription`, `Resume-PnPWorkflowInstance`, `Start-PnPWorkflowInstance` and `Stop-PnPWorkflowInstance` due to deprecated of the Workflow Services in SharePoint Online. - Renamed `Test-PnPOffice365AliasIsUsed` to `Test-PnPMicrosoft365AliasIsUsed` - Refactored some of the Taxonomy cmdlet parameters. See documentation. +- Change in `Copy-PnPFile` which should resolve some issues you may run into when copying files [PR #2796](https://github.com/pnp/PnP-PowerShell/pull/2796) ### Contributors +- Carlos Marins Jr [kadu-jr] - Aimery Thomas [a1mery] - Veronique Lengelle [veronicageek] diff --git a/src/Commands/Files/CopyFile.cs b/src/Commands/Files/CopyFile.cs index c554c1137..21345b01c 100644 --- a/src/Commands/Files/CopyFile.cs +++ b/src/Commands/Files/CopyFile.cs @@ -52,8 +52,9 @@ protected override void ExecuteCmdlet() TargetUrl = UrlUtility.Combine(webServerRelativeUrl, TargetUrl); } + string sourceFolder = SourceUrl.Substring(0, SourceUrl.LastIndexOf('/')); Uri currentContextUri = new Uri(ClientContext.Url); - Uri sourceUri = new Uri(currentContextUri, SourceUrl); + Uri sourceUri = new Uri(currentContextUri, sourceFolder); Uri sourceWebUri = Microsoft.SharePoint.Client.Web.WebUrlFromFolderUrlDirect(ClientContext, sourceUri); Uri targetUri = new Uri(currentContextUri, TargetUrl); Uri targetWebUri = Microsoft.SharePoint.Client.Web.WebUrlFromFolderUrlDirect(ClientContext, targetUri);