Skip to content
This repository has been archived by the owner on Jan 19, 2021. It is now read-only.

sourceUri is now generated using the file's folder URL instead of the file URL.(Issue 2780) #2796

Merged
merged 4 commits into from
Dec 1, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 3 additions & 9 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,13 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
### Changed
- Small fixes to README.md
- Fixed several issues with `Get-PnPSubwebs` and introduced optional parameter `-IncludeRootWeb` to include the rootweb in the results
- 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)
- Changed fallback scenario for 'Get-PnPFile' where downloading a file created by a user that no longer exists would try a different technique to download the file. This only worked on English environments though. With this fix, it should work for any language. [PR #2852](https://github.com/pnp/PnP-PowerShell/pull/2852)

### Contributors
- David Blaszyk [acornsoft]
- Koen Zomers [koenzomers]

## [3.27.2011.0]

### Added

### Changed
- Changed fallback scenario for 'Get-PnPFile' where downloading a file created by a user that no longer exists would try a different technique to download the file. This only worked on English environments though. With this fix, it should work for any language. [PR #2852](https://github.com/pnp/PnP-PowerShell/pull/2852)

### Contributors
- Carlos Marins Jr [kadu-jr]
- Heinrich Ulbricht [heinrich-ulbricht]

## [3.26.2010.0]
Expand Down
3 changes: 2 additions & 1 deletion Commands/Files/CopyFile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,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);
Expand Down