Skip to content

Commit 233a3ee

Browse files
committed
updated extension finder
1 parent c3634c2 commit 233a3ee

File tree

1 file changed

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

1 file changed

+6
-6
lines changed

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,10 @@ import { Button, Combobox } from '@/components/emcn/components'
88
import { Progress } from '@/components/ui/progress'
99
import { cn } from '@/lib/core/utils/cn'
1010
import type { WorkspaceFileRecord } from '@/lib/uploads/contexts/workspace'
11+
import { getExtensionFromMimeType } from '@/lib/uploads/utils/file-utils'
12+
import { useSubBlockValue } from '@/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/hooks/use-sub-block-value'
1113
import { useWorkflowRegistry } from '@/stores/workflows/registry/store'
1214
import { useWorkflowStore } from '@/stores/workflows/workflow/store'
13-
import { useSubBlockValue } from '../../hooks/use-sub-block-value'
1415

1516
const logger = createLogger('FileUpload')
1617

@@ -104,11 +105,10 @@ export function FileUpload({
104105
}
105106

106107
if (acceptedType.startsWith('.')) {
107-
const extension = acceptedType.slice(1) // 'pdf' from '.pdf'
108-
return (
109-
normalizedFileType.endsWith(`/${extension}`) ||
110-
normalizedFileType.includes(`${extension}`)
111-
)
108+
const extension = acceptedType.slice(1).toLowerCase()
109+
const fileExtension = getExtensionFromMimeType(normalizedFileType)
110+
if (fileExtension === extension) return true
111+
return normalizedFileType.endsWith(`/${extension}`)
112112
}
113113

114114
return false

0 commit comments

Comments
 (0)