Merge branch 'fixBadvalue' into 'main'

Fix bad value assignment

See merge request v3/service/configuration!35
This commit is contained in:
Sylvain Briat 2023-11-16 09:38:48 +00:00
commit 41ed0fcec7
3 changed files with 9 additions and 4 deletions

4
package-lock.json generated
View File

@ -1,12 +1,12 @@
{ {
"name": "@mobicoop/configuration", "name": "@mobicoop/configuration",
"version": "2.5.1", "version": "2.5.2",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "@mobicoop/configuration", "name": "@mobicoop/configuration",
"version": "2.5.1", "version": "2.5.2",
"license": "AGPL", "license": "AGPL",
"dependencies": { "dependencies": {
"@grpc/grpc-js": "^1.9.9", "@grpc/grpc-js": "^1.9.9",

View File

@ -1,6 +1,6 @@
{ {
"name": "@mobicoop/configuration", "name": "@mobicoop/configuration",
"version": "2.5.1", "version": "2.5.2",
"description": "Mobicoop V3 Configuration Service", "description": "Mobicoop V3 Configuration Service",
"author": "sbriat", "author": "sbriat",
"private": true, "private": true,

View File

@ -29,7 +29,12 @@ export class SetConfigurationService implements ICommandHandler {
`${command.value}`, `${command.value}`,
configurationType, configurationType,
); );
if (isNaN(value)) throw new ArgumentInvalidException('Bad value'); if (
(configurationType === ConfigurationType.INT ||
configurationType === ConfigurationType.FLOAT) &&
isNaN(value)
)
throw new ArgumentInvalidException('Bad value');
return await this.configurationRepository.set( return await this.configurationRepository.set(
command.configurationIdentifier.domain, command.configurationIdentifier.domain,
command.configurationIdentifier.key, command.configurationIdentifier.key,