Merge pull request #4241 from MaximilianKrambach/csvExport
explicitly set mimetype for csv export
This commit is contained in:
commit
dc1e48329f
@ -154,7 +154,7 @@ export class CsvExportService {
|
|||||||
})
|
})
|
||||||
.join(lineSeparator);
|
.join(lineSeparator);
|
||||||
|
|
||||||
this.exporter.saveFile(csvContentAsString, filename);
|
this.exporter.saveFile(csvContentAsString, filename, 'text/csv');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -14,9 +14,14 @@ export class FileExportService {
|
|||||||
* Saves a file
|
* Saves a file
|
||||||
* @param file
|
* @param file
|
||||||
* @param filename
|
* @param filename
|
||||||
|
* @param mimeType an optional mime type
|
||||||
*/
|
*/
|
||||||
public saveFile(file: BlobPart, filename: string): void {
|
public saveFile(file: BlobPart, filename: string, mimeType?: string): void {
|
||||||
const blob = new Blob([file]);
|
const options: BlobPropertyBag = {};
|
||||||
|
if (mimeType) {
|
||||||
|
options.type = mimeType;
|
||||||
|
}
|
||||||
|
const blob = new Blob([file], options);
|
||||||
saveAs(blob, filename, { autoBOM: true });
|
saveAs(blob, filename, { autoBOM: true });
|
||||||
// autoBOM = automatic byte-order-mark
|
// autoBOM = automatic byte-order-mark
|
||||||
}
|
}
|
||||||
|
@ -112,7 +112,7 @@ export class AgendaImportListComponent extends BaseImportListComponent<ViewCreat
|
|||||||
'Break,,0:10,,internal',
|
'Break,,0:10,,internal',
|
||||||
'Demo 2,Demo text 2,1:30,,hidden'
|
'Demo 2,Demo text 2,1:30,,hidden'
|
||||||
];
|
];
|
||||||
this.exporter.saveFile(rows.join('\n'), this.translate.instant('Topic example') + '.csv');
|
this.exporter.saveFile(rows.join('\n'), this.translate.instant('Topic example') + '.csv', 'text/csv');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -75,6 +75,6 @@ export class MotionCsvExportService {
|
|||||||
'B1,Title 2,Text 2,Reason 2,Submitter B, Category B,, Block A',
|
'B1,Title 2,Text 2,Reason 2,Submitter B, Category B,, Block A',
|
||||||
',Title 3, Text 3,,,,,'
|
',Title 3, Text 3,,,,,'
|
||||||
];
|
];
|
||||||
this.fileExport.saveFile(rows.join('\n'), this.translate.instant('motions-example') + '.csv');
|
this.fileExport.saveFile(rows.join('\n'), this.translate.instant('motions-example') + '.csv', 'text/csv');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -52,7 +52,8 @@ export class StatuteCsvExportService {
|
|||||||
];
|
];
|
||||||
this.fileExport.saveFile(
|
this.fileExport.saveFile(
|
||||||
rows.join('\n'),
|
rows.join('\n'),
|
||||||
`${this.translate.instant('Statutes')} - ${this.translate.instant('example')}.csv`
|
`${this.translate.instant('Statutes')} - ${this.translate.instant('example')}.csv`,
|
||||||
|
'text/csv'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -69,7 +69,7 @@ export class UserImportListComponent extends BaseImportListComponent<ViewUser> {
|
|||||||
',Fred,Bloggs,London,,,,,,,,',
|
',Fred,Bloggs,London,,,,,,,,',
|
||||||
',,Executive Board,,,,,,,1,,'
|
',,Executive Board,,,,,,,1,,'
|
||||||
];
|
];
|
||||||
this.exporter.saveFile(rows.join('\n'), this.translate.instant('participants-example') + '.csv');
|
this.exporter.saveFile(rows.join('\n'), this.translate.instant('participants-example') + '.csv', 'text/csv');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -3,7 +3,7 @@ coverage
|
|||||||
flake8
|
flake8
|
||||||
isort
|
isort
|
||||||
mypy
|
mypy
|
||||||
pytest
|
pytest<4.2.0
|
||||||
pytest-django
|
pytest-django
|
||||||
pytest-asyncio
|
pytest-asyncio
|
||||||
pytest-cov
|
pytest-cov
|
||||||
|
Loading…
Reference in New Issue
Block a user