ARK-Builders / ARK-Memo

ARK Memo is one app for all of your notes: it's aiming to combine plain text, voice and hand-written notes
MIT License
2 stars 3 forks source link

Prevent creation of notes with the same `ResourceId` #16

Open kirillt opened 1 year ago

kirillt commented 1 year ago

It is pretty easy to create a pair of text documents with the same content, the same content would result in the same ResourceId. We should prevent creation of resources with duplicated id.

There are 2 ways of solving this:

  1. Calculate ResourceId of note being saved, lookup into the index for this id. If the id is already existing — forbid saving of the note.
  2. Automatically add nonce to the note. This requires changing structure of a note — it can't be plain text anymore, we need to add nonce into separate field of it.
kirillt commented 1 year ago

Or we can just lock save button is the id already exists. User can change the content and unlock the button.