Merge pull request #366 from matioku/fix/share-url-construction

fix(events): fix share/open-in-new-tab URL construction
This commit is contained in:
edidealt 2026-03-20 22:57:53 +00:00
commit 086b190308

View file

@ -1633,21 +1633,19 @@ 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(() => {
showNotification('Link copied to clipboard!'); showNotification('Link copied to clipboard!');
}); });
} else if (action === 'open-in-new-tab') { } else if (action === 'open-in-new-tab') {
// Use stored href from card if available and not a track, 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 contextType = contextMenu?._contextType; const url = storedHref
const url =
storedHref && contextType !== 'track'
? `${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');