Browse Source
Bugfix/fix file type detection for import (#587)
* Fix file type detection ("application/vnd.ms-excel" instead of "text/csv")
* Update changelog
pull/588/head
Thomas Kaul
3 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with
15 additions and
6 deletions
-
CHANGELOG.md
-
apps/client/src/app/pages/portfolio/transactions/transactions-page.component.ts
|
|
@ -5,16 +5,22 @@ All notable changes to this project will be documented in this file. |
|
|
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), |
|
|
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). |
|
|
|
|
|
|
|
## Unreleased |
|
|
|
|
|
|
|
### Changed |
|
|
|
|
|
|
|
- Upgraded `prisma` from version `3.6.0` to `3.7.0` |
|
|
|
|
|
|
|
### Fixed |
|
|
|
|
|
|
|
- Fixed the file type detection in the import functionality for transactions |
|
|
|
|
|
|
|
## 1.95.0 - 26.12.2021 |
|
|
|
|
|
|
|
### Added |
|
|
|
|
|
|
|
- Added a warning to the log if the data gathering fails |
|
|
|
|
|
|
|
### Changed |
|
|
|
|
|
|
|
- Upgraded `prisma` from version `3.6.0` to `3.7.0` |
|
|
|
|
|
|
|
### Fixed |
|
|
|
|
|
|
|
- Filtered potential `null` currencies |
|
|
|
|
|
@ -188,7 +188,7 @@ export class TransactionsPageComponent implements OnDestroy, OnInit { |
|
|
|
const fileContent = readerEvent.target.result as string; |
|
|
|
|
|
|
|
try { |
|
|
|
if (file.type === 'application/json') { |
|
|
|
if (file.name.endsWith('.json')) { |
|
|
|
const content = JSON.parse(fileContent); |
|
|
|
|
|
|
|
if (!isArray(content.orders)) { |
|
|
@ -203,11 +203,12 @@ export class TransactionsPageComponent implements OnDestroy, OnInit { |
|
|
|
|
|
|
|
this.handleImportSuccess(); |
|
|
|
} catch (error) { |
|
|
|
console.error(error); |
|
|
|
this.handleImportError({ error, orders: content.orders }); |
|
|
|
} |
|
|
|
|
|
|
|
return; |
|
|
|
} else if (file.type === 'text/csv') { |
|
|
|
} else if (file.name.endsWith('.csv')) { |
|
|
|
try { |
|
|
|
await this.importTransactionsService.importCsv({ |
|
|
|
fileContent, |
|
|
@ -217,6 +218,7 @@ export class TransactionsPageComponent implements OnDestroy, OnInit { |
|
|
|
|
|
|
|
this.handleImportSuccess(); |
|
|
|
} catch (error) { |
|
|
|
console.error(error); |
|
|
|
this.handleImportError({ |
|
|
|
error: { |
|
|
|
error: { message: error?.error?.message ?? [error?.message] } |
|
|
@ -230,6 +232,7 @@ export class TransactionsPageComponent implements OnDestroy, OnInit { |
|
|
|
|
|
|
|
throw new Error(); |
|
|
|
} catch (error) { |
|
|
|
console.error(error); |
|
|
|
this.handleImportError({ |
|
|
|
error: { error: { message: ['Unexpected format'] } }, |
|
|
|
orders: [] |
|
|
|