Skip to content

Build your personal knowledge base with Trilium Notes

shareUrl: use URL interface instead of string manipulations

contributore937f1b6012c
diff --git a/apps/client/src/widgets/shared_info.tsx b/apps/client/src/widgets/shared_info.tsx
index cb98027c25..bd0b72bc23 100644
--- a/apps/client/src/widgets/shared_info.tsx
+++ b/apps/client/src/widgets/shared_info.tsx
@@ -24,8 +24,7 @@ export default function SharedInfo() {
const shareId = getShareId(note);
if (syncServerHost) {
- const cleanedServerHost = syncServerHost.replace(/\/$/, "");
- link = `${cleanedServerHost}/share/${shareId}`;
+ link = new URL(`/share/${shareId}`, syncServerHost).href;
} else {
let host = location.host;
if (host.endsWith("/")) {