Skip to content

Commit

Permalink
Merge pull request #2857 from RoelVB/fix/fromAbsolutePath
Browse files Browse the repository at this point in the history
Fix: fromAbsolutePath methods reference undefined `this`
  • Loading branch information
patrick-rodgers authored Jan 8, 2024
2 parents 651aa59 + cdd9d02 commit 742b831
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/sp/files/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -543,7 +543,7 @@ export function fileFromServerRelativePath(base: ISPQueryable, serverRelativePat
*/
export async function fileFromAbsolutePath(base: ISPQueryable, absoluteFilePath: string): Promise<IFile> {

const { WebFullUrl } = await File(this).using(BatchNever()).getContextInfo(absoluteFilePath);
const { WebFullUrl } = await File(base).using(BatchNever()).getContextInfo(absoluteFilePath);
const { pathname } = new URL(absoluteFilePath);
return fileFromServerRelativePath(File([base, combine(WebFullUrl, "_api/web")]), decodeURIComponent(pathname));
}
Expand Down
2 changes: 1 addition & 1 deletion packages/sp/folders/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ export function folderFromServerRelativePath(base: ISPQueryable, serverRelativeP
*/
export async function folderFromAbsolutePath(base: ISPQueryable, absoluteFolderPath: string): Promise<IFolder> {

const { WebFullUrl } = await Folder(this).using(BatchNever()).getContextInfo(absoluteFolderPath);
const { WebFullUrl } = await Folder(base).using(BatchNever()).getContextInfo(absoluteFolderPath);
const { pathname } = new URL(absoluteFolderPath);
return folderFromServerRelativePath(Folder([base, combine(WebFullUrl, "_api/web")]), decodeURIComponent(pathname));
}
Expand Down

0 comments on commit 742b831

Please sign in to comment.