invalid song test

This commit is contained in:
GitBluub
2023-03-22 16:48:44 +09:00
parent c1f8ab51b0
commit 34c7205cfe
3 changed files with 9 additions and 1 deletions

View File

@@ -196,7 +196,12 @@ def handleStartMessage(start_message):
song_id = start_message["id"]
# TODO: use something secure here but I don't find sending a jwt something elegant.
user_id = start_message["user_id"]
song_path = requests.get(f"{BACK_URL}/song/{song_id}").json()["midiPath"];song_path = song_path.replace("/musics/", MUSICS_FOLDER)
try:
song_path = requests.get(f"{BACK_URL}/song/{song_id}").json()["midiPath"];song_path = song_path.replace("/musics/", MUSICS_FOLDER)
except Exception:
fatal("invalid song id")
send({"error": "Invalid song id"})
exit()
return mode, song_path, song_id, user_id

View File

@@ -0,0 +1,2 @@
{"type":"start", "id": 0, "mode": "normal", "user_id": 1}

View File

@@ -0,0 +1 @@
{"error": "Invalid song id"}