refactor(editor): Optimize the logic of replacing illegal characters in download workflow naming (#16260)

This commit is contained in:
luka
2025-06-17 23:15:16 +08:00
committed by GitHub
parent 7415125da5
commit c64ccf74a2
3 changed files with 185 additions and 1 deletions

View File

@@ -60,6 +60,7 @@ import { useNpsSurveyStore } from '@/stores/npsSurvey.store';
import { type BaseTextKey, useI18n } from '@n8n/i18n';
import { ProjectTypes } from '@/types/projects.types';
import { useWorkflowSaving } from '@/composables/useWorkflowSaving';
import { sanitizeFilename } from '@/utils/fileUtils';
const props = defineProps<{
readOnly?: boolean;
@@ -466,7 +467,7 @@ async function onWorkflowMenuSelect(action: WORKFLOW_MENU_ACTIONS): Promise<void
});
let name = props.name || 'unsaved_workflow';
name = name.replace(/[^a-z0-9]/gi, '_');
name = sanitizeFilename(name);
telemetry.track('User exported workflow', { workflow_id: workflowData.id });
saveAs(blob, name + '.json');