Skip to content

Commit

Permalink
fix validation for namespace name #1376 (#1452)
Browse files Browse the repository at this point in the history
* fix validation for namespace name #1376

* Update src/language/en-US.json

Co-authored-by: Xavi Artigas <xavierartigas@yahoo.es>

* Update src/language/en-US.json

Co-authored-by: Xavi Artigas <xavierartigas@yahoo.es>

* add comment to update regex when rest is fixed

Co-authored-by: Xavi Artigas <xavierartigas@yahoo.es>
  • Loading branch information
bassemmagdy and segfaultxavi committed Jun 14, 2021
1 parent eaf4757 commit 5733bce
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/core/validation/ValidationRuleset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,10 @@ export const createValidationRuleSet = ({
namespaceDuration: `required|min_value:${
minNamespaceDuration / networkConfig[NetworkType.TEST_NET].networkConfigurationDefaults.blockGenerationTargetTime
}|maxNamespaceDuration`,
// remove symbol from regex when rest https://github.com/nemtech/catapult-rest/issues/631 fixed
namespaceName: {
required: true,
regex: '^[a-z0-9]{1}[a-z0-9-_]{0,63}$',
regex: '^(?!symbol$)([a-z0-9]{1}[a-z0-9-_]{0,63})$',
},
subNamespaceName: {
required: true,
Expand Down
4 changes: 2 additions & 2 deletions src/language/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@
"Failure_Metadata_Value_Size_Delta_Too_Large": "Validation failed because the metadata value size delta is larger in magnitude than the value size",
"Failure_Metadata_Value_Size_Delta_Mismatch": "Validation failed because the metadata value size delta does not match expected value based on the current state",
"Failure_Metadata_Value_Change_Irreversible": "Validation failed because a metadata value change (truncation) is irreversible",
"Failure_Mosaic_Invalid_Duration": "Validation failed because the duration has an invalid value",
"Failure_Mosaic_Invalid_Duration": "Validation failed because the mosaic's duration has an invalid value",
"Failure_Mosaic_Invalid_Name": "Validation failed because the name is invalid",
"Failure_Mosaic_Name_Id_Mismatch": "Validation failed because the name and id don't match",
"Failure_Mosaic_Expired": "Validation failed because the parent is expired",
Expand Down Expand Up @@ -433,7 +433,7 @@
"Failure_Multisig_Loop": "Validation failed because a multisig loop is created",
"Failure_Multisig_Max_Multisig_Depth": "Validation failed because the max multisig depth is exceeded",
"Failure_Multisig_Operation_Prohibited_By_Account": "Validation failed because an operation is not permitted by a multisig account",
"Failure_Namespace_Invalid_Duration": "Validation failed because the duration has an invalid value",
"Failure_Namespace_Invalid_Duration": "Validation failed because the namespace's duration has an invalid value",
"Failure_Namespace_Invalid_Name": "Validation failed because the name is invalid",
"Failure_Namespace_Name_Id_Mismatch": "Validation failed because the name and id don't match",
"Failure_Namespace_Expired": "Validation failed because the parent is expired",
Expand Down

0 comments on commit 5733bce

Please sign in to comment.