Merge branch 'main' of github.com:ghostfolio/ghostfolio
All checks were successful
Docker image CD / build_and_push (push) Successful in 21m51s
All checks were successful
Docker image CD / build_and_push (push) Successful in 21m51s
This commit is contained in:
commit
28dd26be97
@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
|
||||
## Unreleased
|
||||
|
||||
### Changed
|
||||
|
||||
- Improved the error message of the currency code validation
|
||||
- Tightened the currency code validation by requiring uppercase letters
|
||||
|
||||
### Fixed
|
||||
|
||||
- Improved the file selector of the activities import functionality to accept case-insensitive file extensions (`.CSV` and `.JSON`)
|
||||
|
@ -25,19 +25,24 @@ export class IsExtendedCurrencyConstraint
|
||||
implements ValidatorConstraintInterface
|
||||
{
|
||||
public defaultMessage() {
|
||||
return '$value must be a valid ISO4217 currency code';
|
||||
return '$property must be a valid ISO4217 currency code';
|
||||
}
|
||||
|
||||
public validate(currency: any) {
|
||||
// Return true if currency is a standard ISO 4217 code or a derived currency
|
||||
return (
|
||||
isISO4217CurrencyCode(currency) ||
|
||||
[
|
||||
...DERIVED_CURRENCIES.map((derivedCurrency) => {
|
||||
return derivedCurrency.currency;
|
||||
}),
|
||||
'USX'
|
||||
].includes(currency)
|
||||
this.isUpperCase(currency) &&
|
||||
(isISO4217CurrencyCode(currency) ||
|
||||
[
|
||||
...DERIVED_CURRENCIES.map((derivedCurrency) => {
|
||||
return derivedCurrency.currency;
|
||||
}),
|
||||
'USX'
|
||||
].includes(currency))
|
||||
);
|
||||
}
|
||||
|
||||
private isUpperCase(aString: string) {
|
||||
return aString === aString?.toUpperCase();
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user