jacob-macleod / Dolphin-Flashcard-App

http://www.dolphinflashcards.com
MIT License
1 stars 3 forks source link

KeyError on create-account endpoint (local database config) #88

Closed jaymeklein closed 3 months ago

jaymeklein commented 3 months ago

I was testing the create-account endpoint via /api/create-account with the following parameters:

{
    "userID": "1231",
    "displayName": "Jayme Klein"
}

database_config.py is configured as type="local"

I had this exception when trying to create a new user:

Flashcard-App\backend\database\local_database.py", line 41, in _traverse_path
    current = current[key]
              ^^^^^^^^^^^^
KeyError: ''

and these were the values the method was using: image

Event with an existing user in the file, the '' key would not be found: image

Should an empty '' key exist in data.json file?

I'm gonna skip this endpoint for the moment.

Please let me know if you need more context or if the issue is not properly writen.

jacob-macleod commented 3 months ago

I've fixed this now, so if you merge from main the changes should be applied. The bug was because for a local database, there was no check done to make sure the keys looked for actually exist.

jaymeklein commented 3 months ago

Perfect, thanks for fixing this issue. I'm gonna keep on my tests branch then, and report any new problems i have with the API.