Skip to content

Commit f8c9516

Browse files
Bill Leoutsakoscursoragent
authored andcommitted
fix(instagram): fail closed when cloud storage status is unknown
Treat loading/error as blocked for requiresCloudStorage uploads, show the warning once the check finishes, and disable selecting local workspace files Meta cannot fetch. Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent 9236d5b commit f8c9516

1 file changed

Lines changed: 11 additions & 6 deletions

File tree

  • apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/file-upload

apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/file-upload/file-upload.tsx

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -222,9 +222,11 @@ export function FileUpload({
222222
const { data: cloudConfigured, isLoading: loadingCloudStatus } = useCloudStorageConfigured(
223223
requiresCloudStorage && !isPreview
224224
)
225-
// Block new uploads until we know cloud is available (avoid creating unpublishable files).
226-
const cloudUploadBlocked =
227-
requiresCloudStorage && (loadingCloudStatus || cloudConfigured === false)
225+
// Fail closed: block until the status check succeeds with true. Loading, errors, and
226+
// explicit false all leave cloudConfigured !== true (avoid Meta-unfetchable files).
227+
const cloudUploadBlocked = requiresCloudStorage && cloudConfigured !== true
228+
const showCloudStorageWarning =
229+
requiresCloudStorage && !loadingCloudStatus && cloudConfigured !== true
228230

229231
const uploadFileMutation = useUploadWorkspaceFile()
230232
const queryClient = useQueryClient()
@@ -473,6 +475,8 @@ export function FileUpload({
473475
* Handle selecting an existing workspace file
474476
*/
475477
const handleSelectWorkspaceFile = (fileId: string) => {
478+
if (cloudUploadBlocked) return
479+
476480
const selectedFile = workspaceFiles.find((f) => f.id === fileId)
477481
if (!selectedFile) return
478482

@@ -622,7 +626,8 @@ export function FileUpload({
622626
return {
623627
label: file.name,
624628
value: file.id,
625-
disabled: !isAccepted,
629+
// When cloud is required, local workspace files are also unpublishable.
630+
disabled: !isAccepted || cloudUploadBlocked,
626631
}
627632
}),
628633
],
@@ -639,7 +644,7 @@ export function FileUpload({
639644
return {
640645
label: file.name,
641646
value: file.id,
642-
disabled: !isAccepted,
647+
disabled: !isAccepted || cloudUploadBlocked,
643648
}
644649
}),
645650
],
@@ -703,7 +708,7 @@ export function FileUpload({
703708
data-testid='file-input-element'
704709
/>
705710

706-
{requiresCloudStorage && cloudConfigured === false && (
711+
{showCloudStorageWarning && (
707712
<div className='mb-2 text-muted-foreground text-xs'>
708713
Cloud storage (S3 or Blob) is required for file uploads. Switch to advanced mode and paste
709714
a public HTTPS URL, or configure S3_BUCKET_NAME / Azure Blob env vars.

0 commit comments

Comments
 (0)