summaryrefslogtreecommitdiff
path: root/server.js
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2022-01-12 13:44:52 +0100
committerTor Andersson <tor@ccxvii.net>2022-01-12 16:16:38 +0100
commitc3d34c80112b291f13375b477e4fb6d70b59ed0a (patch)
tree3713427c1d632f5c8da5ce579c564f375c27d976 /server.js
parent987686b489dd7965a092fe83d4e8add1d9254f34 (diff)
downloadserver-c3d34c80112b291f13375b477e4fb6d70b59ed0a.tar.gz
Tweak replay access links and gracefully handle broken replay logs.
Diffstat (limited to 'server.js')
-rw-r--r--server.js4
1 files changed, 1 insertions, 3 deletions
diff --git a/server.js b/server.js
index d1f6ac8..b1aa38f 100644
--- a/server.js
+++ b/server.js
@@ -1405,10 +1405,8 @@ app.get('/replay/:game_id', function (req, res) {
if (game.status < 2)
return res.status(404).send("Invalid game ID.");
let players = SQL_SELECT_PLAYERS_JOIN.all(game_id);
- let replay = SQL_SELECT_REPLAY.all(game_id);
- if (replay.length > 0)
- return res.json({players, replay});
let state = SQL_SELECT_GAME_STATE.get(game_id);
+ let replay = SQL_SELECT_REPLAY.all(game_id);
return res.json({players, state, replay});
});