fix: delivery zip downloads from correct deliveries storage bucket

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Krao Hasanee
2026-06-02 23:59:34 -04:00
parent 71a8ed1b43
commit 85625f4d95
+3 -3
View File
@@ -414,7 +414,7 @@ export default function TaskDetail() {
setComments(prev => prev.filter(c => c.id !== commentId));
};
const downloadAllFiles = async (files, label = 'files') => {
const downloadAllFiles = async (files, label = 'files', bucket = 'submissions') => {
if (downloading) return;
setDownloading('all');
setDlProgress({ active: true, label: 'Preparing…', percent: 0 });
@@ -424,7 +424,7 @@ export default function TaskDetail() {
const file = files[i];
setDlProgress({ active: true, label: file.name, percent: Math.round((i / (files.length + 1)) * 100) });
try {
const { data } = await supabase.storage.from('submissions').createSignedUrl(file.storage_path, 3600, { download: file.name });
const { data } = await supabase.storage.from(bucket).createSignedUrl(file.storage_path, 3600, { download: file.name });
if (data?.signedUrl) {
const response = await fetch(data.signedUrl);
if (response.ok) zip.file(file.name, await response.blob());
@@ -693,7 +693,7 @@ export default function TaskDetail() {
</div>
: <div style={{ fontSize: 13, color: 'var(--text-muted)' }}>No notes provided.</div>
}
<SubmissionFiles files={sub.files} downloading={downloading} onDownloadAll={(f) => downloadAllFiles(f, `Submission ${i + 1}`)} />
<SubmissionFiles files={sub.files} downloading={downloading} onDownloadAll={(f) => downloadAllFiles(f, `Submission ${i + 1}`, 'deliveries')} />
</div>
);
})}