mirror of
https://github.com/placeAtlas/atlas.git
synced 2024-12-26 19:44:12 +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": "integer"
|
||||
"type": "integer",
|
||||
"minimum": 0
|
||||
}
|
||||
],
|
||||
"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":
|
||||
|
||||
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}
|
||||
|
||||
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}
|
||||
|
||||
|
|
|
@ -260,7 +260,7 @@ function initDraw() {
|
|||
|
||||
function generateExportObject() {
|
||||
const exportObject = {
|
||||
id: entryId ?? 0,
|
||||
id: entryId ?? -1,
|
||||
name: nameField.value,
|
||||
description: descriptionField.value,
|
||||
links: {},
|
||||
|
|
Loading…
Reference in a new issue