Skip to content

Commit

Permalink
fix: enforce lowecase valid hostname for space domain
Browse files Browse the repository at this point in the history
  • Loading branch information
wa0x6e committed Sep 24, 2024
1 parent d6f0fad commit 48f7ad1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/schemas/space.json
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,10 @@
},
"domain": {
"type": "string",
"allOf": [
{ "format": "hostname" },
{ "format": "lowercase" }
],
"title": "domain",
"maxLength": 64
},
Expand Down
4 changes: 4 additions & 0 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,10 @@ ajv.addFormat('long', {
validate: () => true
});

ajv.addFormat('lowercase', {
validate: (value: string) => value === value.toLowerCase()
});

ajv.addFormat('ethValue', {
validate: (value: string) => {
if (!value.match(/^([0-9]|[1-9][0-9]+)(\.[0-9]+)?$/)) return false;
Expand Down

0 comments on commit 48f7ad1

Please sign in to comment.