fix(events): fix share/open-in-new-tab URL construction

This commit is contained in:
matioku 2026-03-20 21:30:15 +01:00
parent 9071670ad9
commit 8f1994d9d3
No known key found for this signature in database
GPG key ID: F4C0A96CD94A5ADF

View file

@ -1310,7 +1310,7 @@ export async function handleTrackAction(
// Use stored href from card if available, otherwise construct URL // Use stored href from card if available, otherwise construct URL
const contextMenu = document.getElementById('context-menu'); const contextMenu = document.getElementById('context-menu');
const storedHref = contextMenu?._contextHref; const storedHref = contextMenu?._contextHref;
const url = getShareUrl(storedHref ? storedHref : `/track/${item.id || item.uuid}`); const url = getShareUrl(storedHref ? storedHref : `/${type}/${item.id || item.uuid}`);
trackCopyLink(type, item.id || item.uuid); trackCopyLink(type, item.id || item.uuid);
navigator.clipboard.writeText(url).then(() => { navigator.clipboard.writeText(url).then(() => {
@ -1322,7 +1322,7 @@ export async function handleTrackAction(
const storedHref = contextMenu?._contextHref; const storedHref = contextMenu?._contextHref;
const url = storedHref const url = storedHref
? `${window.location.origin}${storedHref}` ? `${window.location.origin}${storedHref}`
: `${window.location.origin}/track/${item.id || item.uuid}`; : `${window.location.origin}/${type}/${item.id || item.uuid}`;
trackOpenInNewTab(type, item.id || item.uuid); trackOpenInNewTab(type, item.id || item.uuid);
window.open(url, '_blank'); window.open(url, '_blank');