Bugfix/fix activities import of files with extension in uppercase (#4596)

* Fix activities import of files with extension in uppercase

* Update changelog
This commit is contained in:
Vinodh Zamboulingame 2025-04-24 20:40:12 +02:00 committed by GitHub
parent 4c63e08e3c
commit 447fe1806f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 9 additions and 2 deletions

View File

@ -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/), 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). 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 ## 2.155.0 - 2025-04-23
### Added ### Added

View File

@ -247,9 +247,10 @@ export class ImportActivitiesDialog implements OnDestroy {
reader.onload = async (readerEvent) => { reader.onload = async (readerEvent) => {
const fileContent = readerEvent.target.result as string; const fileContent = readerEvent.target.result as string;
const fileExtension = file.name.split('.').pop()?.toLowerCase();
try { try {
if (file.name.endsWith('.json')) { if (fileExtension === 'json') {
const content = JSON.parse(fileContent); const content = JSON.parse(fileContent);
this.accounts = content.accounts; this.accounts = content.accounts;
@ -294,7 +295,7 @@ export class ImportActivitiesDialog implements OnDestroy {
} }
return; return;
} else if (file.name.endsWith('.csv')) { } else if (fileExtension === 'csv') {
const content = fileContent.split('\n').slice(1); const content = fileContent.split('\n').slice(1);
try { try {