Skip to content

Commit 961d55c

Browse files
Merge pull request #900 from appwrite/fix-cli-invalid-int
Use JSONbig to parse and stringify JSON
2 parents 5b6d244 + c4fa9ec commit 961d55c

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

templates/cli/lib/client.js.twig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ class Client {
118118

119119
body = formData;
120120
} else {
121-
body = JSON.stringify(params);
121+
body = JSONbig.stringify(params);
122122
}
123123

124124
let response = undefined;
@@ -174,7 +174,7 @@ class Client {
174174
const text = await response.text();
175175
let json = undefined;
176176
try {
177-
json = JSON.parse(text);
177+
json = JSONbig.parse(text);
178178
} catch (error) {
179179
return text;
180180
}

templates/cli/lib/commands/push.js.twig

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -354,8 +354,8 @@ const createAttribute = async (databaseId, collectionId, attribute) => {
354354
collectionId,
355355
key: attribute.key,
356356
required: attribute.required,
357-
min: parseInt(attribute.min.toString()),
358-
max: parseInt(attribute.max.toString()),
357+
min: attribute.min,
358+
max: attribute.max,
359359
xdefault: attribute.default,
360360
array: attribute.array,
361361
parseOutput: false
@@ -366,8 +366,8 @@ const createAttribute = async (databaseId, collectionId, attribute) => {
366366
collectionId,
367367
key: attribute.key,
368368
required: attribute.required,
369-
min: parseFloat(attribute.min.toString()),
370-
max: parseFloat(attribute.max.toString()),
369+
min: attribute.min,
370+
max: attribute.max,
371371
xdefault: attribute.default,
372372
array: attribute.array,
373373
parseOutput: false
@@ -471,8 +471,8 @@ const updateAttribute = async (databaseId, collectionId, attribute) => {
471471
collectionId,
472472
key: attribute.key,
473473
required: attribute.required,
474-
min: parseInt(attribute.min.toString()),
475-
max: parseInt(attribute.max.toString()),
474+
min: attribute.min,
475+
max: attribute.max,
476476
xdefault: attribute.default,
477477
array: attribute.array,
478478
parseOutput: false
@@ -483,8 +483,8 @@ const updateAttribute = async (databaseId, collectionId, attribute) => {
483483
collectionId,
484484
key: attribute.key,
485485
required: attribute.required,
486-
min: parseFloat(attribute.min.toString()),
487-
max: parseFloat(attribute.max.toString()),
486+
min: attribute.min,
487+
max: attribute.max,
488488
xdefault: attribute.default,
489489
array: attribute.array,
490490
parseOutput: false

0 commit comments

Comments
 (0)