fix(media): quote forwarded cookie headers

Keep yt-dlp config values intact and require explicit media metadata before downloads can start.
This commit is contained in:
NimBold
2026-07-10 00:27:44 +03:30
parent b1c84a0fb9
commit c5025fd5a0
4 changed files with 45 additions and 11 deletions
+8 -1
View File
@@ -187,11 +187,15 @@ describe('add download metadata workflow', () => {
expect(updated[0]).toBe(current);
});
it('allows ready and failed rows but blocks loading and invalid rows', () => {
it('allows normal-download fallback but blocks unresolved explicit media', () => {
expect(canSubmitMetadataRows([
row(),
row({ id: 'fallback', status: 'metadata-error' })
])).toBe(true);
expect(canSubmitMetadataRows([
row(),
row({ id: 'media-fallback', status: 'metadata-error', isMedia: true })
])).toBe(false);
expect(canSubmitMetadataRows([row({ status: 'loading' })])).toBe(false);
expect(canSubmitMetadataRows([row({ status: 'invalid' })])).toBe(false);
});
@@ -246,6 +250,9 @@ describe('add download metadata workflow', () => {
expect(metadataSummaryMessage([
row({ status: 'metadata-error' })
])).toContain('can still be added');
expect(metadataSummaryMessage([
row({ status: 'metadata-error', isMedia: true })
])).toContain('Refresh metadata before adding');
expect(metadataSummaryMessage([
row({ status: 'invalid' })
])).toContain('Correct or remove 1 invalid URL');
+8 -1
View File
@@ -146,7 +146,10 @@ export const refreshFailedMetadataRows = (
export const canSubmitMetadataRows = (rows: AddDownloadDraftRow[]): boolean =>
rows.length > 0
&& rows.every(row => row.status === 'ready' || row.status === 'metadata-error');
&& rows.every(row =>
row.status === 'ready'
|| (!row.isMedia && row.status === 'metadata-error')
);
export const mediaFormatSelectorForRow = (
row: AddDownloadDraftRow
@@ -203,7 +206,11 @@ export const metadataSummaryMessage = (rows: AddDownloadDraftRow[]): string => {
}
const failed = rows.filter(row => row.status === 'metadata-error').length;
const failedMedia = rows.filter(row => row.status === 'metadata-error' && row.isMedia).length;
const ready = rows.filter(row => row.status === 'ready').length;
if (failedMedia > 0) {
return `Media metadata is unavailable for ${failedMedia} item${failedMedia === 1 ? '' : 's'}. Refresh metadata before adding.`;
}
if (failed === rows.length) {
return 'Metadata is unavailable. Downloads can still be added using fallback details.';
}