fix(downloads): stop repeating an extension the name already carries

A voice comment's display name is the generated file name, extension
included, so appending the extension again downloaded it as
<uuid>.webm.webm. Both download paths, the single asset route and the
project zip, now append only when the name does not already end in it.
This commit is contained in:
yusufipk
2026-07-30 23:13:04 +07:00
parent e7008c571a
commit 93e85683e9
5 changed files with 69 additions and 8 deletions
+24
View File
@@ -1221,6 +1221,30 @@ describe('buildProjectDownloadManifest assets', () => {
expect(manifest.files[0]?.fileName).toBe('01-Intro-asset-B roll.png');
});
// A voice comment's display name is the stored file name, extension included.
it('does not repeat an extension the display name already carries', () => {
const manifest = buildProjectDownloadManifest(
'Project',
[
video({
versions: [],
assets: [
asset({
provider: VideoAssetProvider.R2_AUDIO,
displayName: '33661b60-b658-47f9-bd40-71c32a0a2fdb.webm',
sourceUrl: '/api/upload/audio/33661b60-b658-47f9-bd40-71c32a0a2fdb.webm',
}),
],
}),
],
{ includeAssets: true }
);
expect(manifest.files[0]?.fileName).toBe(
'01-Intro-asset-33661b60-b658-47f9-bd40-71c32a0a2fdb.webm'
);
});
it('always names a bunny asset .mp4 regardless of the source url', () => {
const manifest = buildProjectDownloadManifest(
'Project',