Support BOM in CSV import (#12993)

Fixes #12970
This commit is contained in:
Rijk van Zanten
2022-04-25 10:39:19 -04:00
committed by GitHub
parent 0f27290fd1
commit 70c70af4ee
3 changed files with 135 additions and 65 deletions

View File

@@ -24,6 +24,7 @@ import { getDateFormatted } from '../utils/get-date-formatted';
import { toArray } from '@directus/shared/utils';
import { NotificationsService } from './notifications';
import logger from '../logger';
import stripBomStream from 'strip-bom-stream';
export class ImportService {
knex: Knex;
@@ -117,6 +118,7 @@ export class ImportService {
return new Promise<void>((resolve, reject) => {
stream
.pipe(stripBomStream())
.pipe(csv())
.on('data', (value: Record<string, string>) => {
const obj = transform(value, (result: Record<string, string>, value, key) => {