Skip to content

Commit

Permalink
Fixed issue when moving list instead of subfolder
Browse files Browse the repository at this point in the history
  • Loading branch information
tavikukko committed Jan 22, 2025
1 parent ba1536b commit 1cc2fbb
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions packages/sp/folders/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -272,16 +272,15 @@ export class _Folder extends _SPInstance<IFolderInfo> {
// add our pre-request actions, this fixes issues with batching hanging #2668
poster.on.pre(noInherit(async (url, init, result) => {

const urlInfo = await Folder(this).using(BatchNever()).getParentInfos();
const { ServerRelativeUrl: srcUrl, ["odata.id"]: absoluteUrl } = await Folder(this).using(BatchNever()).select("ServerRelativeUrl")();
const uri = new URL(extractWebUrl(absoluteUrl));

const uri = new URL(urlInfo.ParentWeb.Url);

url = combine(urlInfo.ParentWeb.Url, `/_api/SP.MoveCopyUtil.${methodName}()`);
url = combine(uri.href, `/_api/SP.MoveCopyUtil.${methodName}()`);

init = body({
destPath: toResourcePath(isUrlAbsolute(destUrl) ? destUrl : combine(uri.origin, destUrl)),
options,
srcPath: toResourcePath(combine(uri.origin, urlInfo.Folder.ServerRelativeUrl)),
srcPath: toResourcePath(combine(uri.origin, srcUrl)),
}, init);

return [url, init, result];
Expand Down

0 comments on commit 1cc2fbb

Please sign in to comment.