diff --git a/src/frontend/src/modals/shareModal/index.tsx b/src/frontend/src/modals/shareModal/index.tsx index d09d03122..1ac076596 100644 --- a/src/frontend/src/modals/shareModal/index.tsx +++ b/src/frontend/src/modals/shareModal/index.tsx @@ -13,7 +13,10 @@ import { saveFlowStore, } from "../../controllers/API"; import { FlowType } from "../../types/flow"; -import { removeApiKeys } from "../../utils/reactflowUtils"; +import { + removeApiKeys, + removeFileNameFromComponents, +} from "../../utils/reactflowUtils"; import { getTagsIds } from "../../utils/storeUtils"; import BaseModal from "../baseModal"; @@ -81,6 +84,8 @@ export default function ShareModal({ }, [component, open, internalOpen]); const handleShareComponent = () => { + //remove file names from flows before sharing + removeFileNameFromComponents(component); const flow: FlowType = checked ? { id: component!.id, diff --git a/src/frontend/src/utils/reactflowUtils.ts b/src/frontend/src/utils/reactflowUtils.ts index 6dbb70651..6c8e8627a 100644 --- a/src/frontend/src/utils/reactflowUtils.ts +++ b/src/frontend/src/utils/reactflowUtils.ts @@ -1096,3 +1096,16 @@ export function updateComponentNameAndType( data: any, component: NodeDataType ) {} + +export function removeFileNameFromComponents(flow: FlowType) { + flow.data!.nodes.forEach((node: NodeType) => { + Object.keys(node.data.node!.template).forEach((field) => { + if (node.data.node?.template[field].type === "file") { + node.data.node!.template[field].value = ""; + } + }); + if (node.data.node?.flow) { + removeFileNameFromComponents(node.data.node.flow); + } + }); +}