diff --git a/ui/src/share/SharePlayer.jsx b/ui/src/share/SharePlayer.jsx index b0414cd01..ed114d4b3 100644 --- a/ui/src/share/SharePlayer.jsx +++ b/ui/src/share/SharePlayer.jsx @@ -103,7 +103,7 @@ const SharePlayer = () => { /> @@ -126,9 +126,12 @@ const SharePlayer = () => { startIcon={} disabled={!shareInfo} onClick={() => { + let url = shareDownloadUrl(shareInfo?.id) downloadFile( shareDownloadUrl(shareInfo?.id), - shareInfo?.description + '.zip', + shareInfo?.description && shareInfo.description.trim() !== '' + ? shareInfo.description + '.zip' + : shareInfo?.id + '.zip', ) setDownloadInfo(null) }} diff --git a/ui/src/share/SharePlayer.test.jsx b/ui/src/share/SharePlayer.test.jsx index dad0acad7..7b2615986 100644 --- a/ui/src/share/SharePlayer.test.jsx +++ b/ui/src/share/SharePlayer.test.jsx @@ -212,6 +212,28 @@ describe('SharePlayer', () => { expect(createdLinks[0]).not.toBeInTheDocument() }) + it('fallback to share id if description is empty', () => { + configModule.shareInfo.description = '' + + render( + + + , + ) + + capturedCustomDownloader({ src: '/share/s/track-1' }) + + fireEvent.click( + screen.getByText('resources.share.actions.download.allTracks'), + ) + + expect(createdLinks).toHaveLength(1) + expect(createdLinks[0].href).toContain('/share/d/share-1') + expect(createdLinks[0].download).toBe('share-1.zip') + expect(createdLinks[0].click).toHaveBeenCalled() + expect(createdLinks[0]).not.toBeInTheDocument() + }) + it('closes the dialog after clicking "All Tracks"', async () => { render(