Skip to content

Commit 2c9a067

Browse files
wa0x6eChaituVR
andauthored
fix: enforce lowecase valid hostname for space domain (#1060)
* fix: enforce lowecase valid hostname for space domain * add domain example * v0.12.14 --------- Co-authored-by: ChaituVR <[email protected]>
1 parent d6f0fad commit 2c9a067

File tree

4 files changed

+10
-1
lines changed

4 files changed

+10
-1
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@snapshot-labs/snapshot.js",
3-
"version": "0.12.13",
3+
"version": "0.12.14",
44
"repository": "snapshot-labs/snapshot.js",
55
"license": "MIT",
66
"main": "dist/snapshot.cjs.js",

src/schemas/space.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,10 @@
103103
},
104104
"domain": {
105105
"type": "string",
106+
"allOf": [
107+
{ "format": "hostname" },
108+
{ "format": "lowercase" }
109+
],
106110
"title": "domain",
107111
"maxLength": 64
108112
},

src/utils.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,10 @@ ajv.addFormat('long', {
113113
validate: () => true
114114
});
115115

116+
ajv.addFormat('lowercase', {
117+
validate: (value: string) => value === value.toLowerCase()
118+
});
119+
116120
ajv.addFormat('ethValue', {
117121
validate: (value: string) => {
118122
if (!value.match(/^([0-9]|[1-9][0-9]+)(\.[0-9]+)?$/)) return false;

test/examples/space.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
"network": "1",
1717
"plugins": {},
1818
"twitter": "lootproject",
19+
"domain": "vote.lootproject.abc",
1920
"strategies": [
2021
{
2122
"name": "erc721",

0 commit comments

Comments
 (0)