Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions apps/web/src/components/OneLoopStudio.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -489,6 +489,7 @@ export default function OneLoopStudio() {
};

const exportPkg = () => {
const filename = studioExportFilename(selected?.title || 'uvai-project');

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Export toast displays an unsanitized filename (e.g. AI Gold Rushes.zip) that does not match the sanitized ZIP actually downloaded (e.g. ai-gold-rushes.zip).

Fix on Vercel

const insightActions = (selected?.insights?.actions || []).flatMap((action) => {
if (typeof action === 'string') {
return action.trim() ? [{ title: action.trim() }] : [];
Expand All @@ -508,7 +509,7 @@ export default function OneLoopStudio() {
packFormation.artifacts.length === 0 &&
packFormation.tools.length === 0
) {
const toast = studioExportToastMessage({ ok: false, kind: 'empty' });
const toast = studioExportToastMessage({ ok: false, kind: 'empty', filename });
setExportToast(toast);
return;
}
Expand All @@ -525,7 +526,6 @@ export default function OneLoopStudio() {
},
});
downloadScaffoldPackage(pkg);
const filename = studioExportFilename(pkg.projectName);
const kind =
packFormation.architecture || packFormation.artifacts.length > 0
? 'pack'
Expand All @@ -543,6 +543,7 @@ export default function OneLoopStudio() {
const toast = studioExportToastMessage({
ok: false,
error: err instanceof Error ? err.message : 'Export failed.',
filename,
});
setExportToast(toast);
}
Expand Down
10 changes: 6 additions & 4 deletions apps/web/src/lib/__tests__/studio-pipeline-status.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -372,18 +372,20 @@ describe('studio-pipeline-status', () => {

it('returns a toast for export success and failure including filename', () => {
expect(studioExportFilename('AI Gold Rushes')).toBe('AI Gold Rushes.zip');
const filename = 'AI Gold Rushes.zip';
const pack = studioExportToastMessage({
ok: true,
kind: 'pack',
filename: 'AI Gold Rushes.zip',
filename,
});
expect(pack.tone).toBe('success');
expect(pack.text).toMatch(/pack exported/i);
expect(pack.text).toContain('AI Gold Rushes.zip');
expect(pack.text).toContain(filename);
expect(studioExportToastMessage({ ok: true, kind: 'sop' }).tone).toBe('success');
const failed = studioExportToastMessage({ ok: false, error: 'Disk full' });
const failed = studioExportToastMessage({ ok: false, error: 'Disk full', filename });
expect(failed.tone).toBe('error');
expect(failed.text).toBe('Disk full');
expect(failed.text).toContain('Disk full');
expect(failed.text).toContain(filename);
expect(studioExportToastMessage({ ok: false, kind: 'empty' }).tone).toBe('error');

const studio = readFileSync(join(process.cwd(), 'src/components/OneLoopStudio.tsx'), 'utf8');
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/lib/studio-pipeline-status.ts
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,7 @@ export function studioExportToastMessage(input: {
if (!input.ok || input.kind === 'empty') {
return {
tone: 'error',
text: input.error || 'Export failed — nothing to export yet.',
text: `${input.error || 'Export failed — nothing to export yet.'}${fileBit}`,
};
}
if (input.kind === 'pack') {
Expand Down