Browse Source

fix(nc-gui): retrieve tn from fileName for csv import

pull/4135/head
Wing-Kam Wong 2 years ago
parent
commit
15bda1fb1c
  1. 5
      packages/nc-gui/utils/parsers/CSVTemplateAdapter.ts

5
packages/nc-gui/utils/parsers/CSVTemplateAdapter.ts

@ -42,10 +42,11 @@ export default class CSVTemplateAdapter {
initTemplate(tableIdx: number, fileName: string, columnNames: string[]) { initTemplate(tableIdx: number, fileName: string, columnNames: string[]) {
const columnNameRowExist = +columnNames.every((v: any) => v === null || typeof v === 'string') const columnNameRowExist = +columnNames.every((v: any) => v === null || typeof v === 'string')
const columnNamePrefixRef: Record<string, any> = { id: 0 } const columnNamePrefixRef: Record<string, any> = { id: 0 }
const tn = fileName.replace(/[` ~!@#$%^&*()_|+\-=?;:'",.<>\{\}\[\]\\\/]/g, '_').trim()
this.project.tables.push({ this.project.tables.push({
table_name: fileName, table_name: tn,
ref_table_name: fileName, ref_table_name: tn,
columns: [], columns: [],
}) })

Loading…
Cancel
Save