fix(shareModal): import removeFileNameFromComponents function to fix compilation error
feat(shareModal): add logic to remove file names from flows before sharing to improve privacy and security feat(reactflowUtils): add removeFileNameFromComponents function to recursively remove file names from flow components
This commit is contained in:
parent
ab56d48002
commit
67e520cfd6
2 changed files with 19 additions and 1 deletions
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue