From 447fe1806fa4fb33fb2d97371b43dd6698909f59 Mon Sep 17 00:00:00 2001 From: Vinodh Zamboulingame <48854069+vzamboulingame@users.noreply.github.com> Date: Thu, 24 Apr 2025 20:40:12 +0200 Subject: [PATCH] Bugfix/fix activities import of files with extension in uppercase (#4596) * Fix activities import of files with extension in uppercase * Update changelog --- CHANGELOG.md | 6 ++++++ .../import-activities-dialog.component.ts | 5 +++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fcc336b3..db8312af 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,12 @@ 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 + +### Fixed + +- Improved the file selector of the activities import functionality to accept case-insensitive file extensions (`.CSV` and `.JSON`) + ## 2.155.0 - 2025-04-23 ### Added diff --git a/apps/client/src/app/pages/portfolio/activities/import-activities-dialog/import-activities-dialog.component.ts b/apps/client/src/app/pages/portfolio/activities/import-activities-dialog/import-activities-dialog.component.ts index 82e78a18..20f13580 100644 --- a/apps/client/src/app/pages/portfolio/activities/import-activities-dialog/import-activities-dialog.component.ts +++ b/apps/client/src/app/pages/portfolio/activities/import-activities-dialog/import-activities-dialog.component.ts @@ -247,9 +247,10 @@ export class ImportActivitiesDialog implements OnDestroy { reader.onload = async (readerEvent) => { const fileContent = readerEvent.target.result as string; + const fileExtension = file.name.split('.').pop()?.toLowerCase(); try { - if (file.name.endsWith('.json')) { + if (fileExtension === 'json') { const content = JSON.parse(fileContent); this.accounts = content.accounts; @@ -294,7 +295,7 @@ export class ImportActivitiesDialog implements OnDestroy { } return; - } else if (file.name.endsWith('.csv')) { + } else if (fileExtension === 'csv') { const content = fileContent.split('\n').slice(1); try {