mirror of
https://github.com/langgenius/dify.git
synced 2026-05-05 18:08:07 +08:00
feat(sandbox): use extension field for file icon type mapping
Enhance getFileIconType to accept an extension parameter and cover all 13 FileAppearanceTypeEnum types using an O(1) Map lookup. Update all call sites to pass the API-provided extension for accurate icon display.
This commit is contained in:
@ -24,7 +24,7 @@ const FilePickerTreeNode: FC<FilePickerTreeNodeProps> = ({ node, style, dragHand
|
||||
const { t } = useTranslation('workflow')
|
||||
const isFolder = node.data.node_type === 'folder'
|
||||
const isSelected = node.isSelected
|
||||
const fileIconType = !isFolder ? getFileIconType(node.data.name) : null
|
||||
const fileIconType = !isFolder ? getFileIconType(node.data.name, node.data.extension) : null
|
||||
|
||||
const handleClick = useCallback((e: React.MouseEvent) => {
|
||||
e.stopPropagation()
|
||||
|
||||
@ -33,7 +33,7 @@ const FileReferenceBlock: FC<FileReferenceBlockProps> = ({ nodeKey, resourceId }
|
||||
const currentNode = useMemo(() => nodeMap?.get(resourceId), [nodeMap, resourceId])
|
||||
const isFolder = currentNode?.node_type === 'folder'
|
||||
const displayName = currentNode?.name ?? resourceId
|
||||
const iconType = !isFolder && currentNode ? getFileIconType(currentNode.name) : null
|
||||
const iconType = !isFolder && currentNode ? getFileIconType(currentNode.name, currentNode.extension) : null
|
||||
const title = currentNode?.path ?? displayName
|
||||
|
||||
const handleSelect = useCallback((node: TreeNodeData) => {
|
||||
|
||||
Reference in New Issue
Block a user