diff options
author | Tor Andersson <tor@ccxvii.net> | 2022-01-12 13:44:52 +0100 |
---|---|---|
committer | Tor Andersson <tor@ccxvii.net> | 2022-01-12 16:16:38 +0100 |
commit | c3d34c80112b291f13375b477e4fb6d70b59ed0a (patch) | |
tree | 3713427c1d632f5c8da5ce579c564f375c27d976 /server.js | |
parent | 987686b489dd7965a092fe83d4e8add1d9254f34 (diff) | |
download | server-c3d34c80112b291f13375b477e4fb6d70b59ed0a.tar.gz |
Tweak replay access links and gracefully handle broken replay logs.
Diffstat (limited to 'server.js')
-rw-r--r-- | server.js | 4 |
1 files changed, 1 insertions, 3 deletions
@@ -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}); }); |