mirror of
https://github.com/makeplane/plane
synced 2025-08-07 19:59:33 +00:00
[WEB-3797] fix: remove leading slash from URL to copy (#6890)
* fix: remove prefix slash if present * chore: make use of URL class to generate a valid URL
This commit is contained in:
committed by
GitHub
parent
27cec64c56
commit
37699362ad
@@ -86,8 +86,11 @@ export const copyTextToClipboard = async (text: string): Promise<void> => {
|
||||
* await copyUrlToClipboard("issues/123") // copies "https://example.com/issues/123"
|
||||
*/
|
||||
export const copyUrlToClipboard = async (path: string) => {
|
||||
const originUrl = typeof window !== "undefined" && window.location.origin ? window.location.origin : "";
|
||||
await copyTextToClipboard(`${originUrl}/${path}`);
|
||||
// get origin or default to empty string if not in browser
|
||||
const originUrl = typeof window !== "undefined" ? window.location.origin : "";
|
||||
// create URL object and ensure proper path formatting
|
||||
const url = new URL(path, originUrl);
|
||||
await copyTextToClipboard(url.toString());
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user