Skip to content

Commit f45fc65

Browse files
committed
🐛 Fix project visibility check to use correct response structure
API returns { build, project } at top level, not project nested under build
1 parent d7f4274 commit f45fc65

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

src/commands/preview.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -448,9 +448,9 @@ export async function previewCommand(
448448
});
449449

450450
// Check project visibility for private projects
451-
let build;
451+
let buildResponse;
452452
try {
453-
build = await getBuild(client, buildId);
453+
buildResponse = await getBuild(client, buildId);
454454
} catch (error) {
455455
if (error.status === 404) {
456456
output.error(`Build not found: ${buildId}`);
@@ -463,8 +463,10 @@ export async function previewCommand(
463463
}
464464

465465
// Check if project is private and user hasn't acknowledged public link access
466+
// Note: API returns { build, project } at top level, not nested
466467
// Use === false to handle undefined/missing isPublic defensively
467-
let isPrivate = build.project && build.project.isPublic === false;
468+
let project = buildResponse.project;
469+
let isPrivate = project && project.isPublic === false;
468470
if (isPrivate && !options.publicLink) {
469471
output.error('This project is private.');
470472
output.blank();

0 commit comments

Comments
 (0)