mirror of
https://github.com/placeAtlas/atlas.git
synced 2025-01-14 06:44:33 +01:00
Use -1 instead of 0 for new entries
Preventing a potential risk of having 0 as the first ever entry, while -1 have a meaning of none
This commit is contained in:
parent
c38cf611cd
commit
f1fa8a104f
3 changed files with 5 additions and 4 deletions
|
@ -10,7 +10,8 @@
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "integer"
|
"type": "integer",
|
||||||
|
"minimum": 0
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"description": "The ID of the entry. Usually this is the post ID of the new entry submission."
|
"description": "The ID of the entry. Usually this is the post ID of the new entry submission."
|
||||||
|
|
|
@ -103,13 +103,13 @@ def set_flair(submission, flair):
|
||||||
|
|
||||||
if submission.link_flair_text == "Edit Entry":
|
if submission.link_flair_text == "Edit Entry":
|
||||||
|
|
||||||
assert submission_json["id"] != 0, "Edit invalid because ID is tampered, it must not be 0!"
|
assert submission_json["id"] > 0, "Edit invalid because ID is tampered, it must not be 0 or -1!"
|
||||||
|
|
||||||
submission_json_dummy = {"id": submission_json["id"], "edit": submission.id}
|
submission_json_dummy = {"id": submission_json["id"], "edit": submission.id}
|
||||||
|
|
||||||
else:
|
else:
|
||||||
|
|
||||||
assert submission_json["id"] == 0, "Edit invalid because ID is tampered, it must be 0!"
|
assert submission_json["id"] <= 0, "Addition invalid because ID is tampered, it must be 0 or -1!"
|
||||||
|
|
||||||
submission_json_dummy = {"id": submission.id}
|
submission_json_dummy = {"id": submission.id}
|
||||||
|
|
||||||
|
|
|
@ -260,7 +260,7 @@ function initDraw() {
|
||||||
|
|
||||||
function generateExportObject() {
|
function generateExportObject() {
|
||||||
const exportObject = {
|
const exportObject = {
|
||||||
id: entryId ?? 0,
|
id: entryId ?? -1,
|
||||||
name: nameField.value,
|
name: nameField.value,
|
||||||
description: descriptionField.value,
|
description: descriptionField.value,
|
||||||
links: {},
|
links: {},
|
||||||
|
|
Loading…
Reference in a new issue