9 lines
291 B
TypeScript
9 lines
291 B
TypeScript
export function decodeSharePointsURL(sharePointsUrl: string) {
|
|
if (!sharePointsUrl.match(/\.sharepoint\.com/)) {
|
|
throw new Error('Invalid SharePoint URL provided');
|
|
}
|
|
|
|
const url = new URL(sharePointsUrl);
|
|
return `${url.protocol}//${url.hostname}${url.searchParams.get('id')}`;
|
|
}
|