fix lookups on replay paths for website (#1281)

This commit is contained in:
NotSoToothless
2026-05-27 09:18:27 -07:00
committed by GitHub
parent 4984ba4f6c
commit 23a9cf8fbf
2 changed files with 12 additions and 1 deletions
+10 -1
View File
@@ -27,7 +27,16 @@ const TSS_BATTLES_DB_PATH = path.join(STORAGE_ROOT, 'tss_battles.db');
fs.mkdirSync(REPLAYS_PATH, { recursive: true }); fs.mkdirSync(REPLAYS_PATH, { recursive: true });
function replayDataPath(sessionId) { function replayDataPath(sessionId) {
return path.join(REPLAYS_PATH, String(sessionId).toLowerCase(), 'replay_data.json.gz'); const sid = String(sessionId).toLowerCase();
const candidates = [
path.join(REPLAYS_PATH, 'SRE', sid, 'replay_data.json.gz'),
path.join(REPLAYS_PATH, 'TSS', sid, 'replay_data.json.gz'),
path.join(REPLAYS_PATH, sid, 'replay_data.json.gz'),
];
for (const p of candidates) {
if (fs.existsSync(p)) return p;
}
return candidates[0];
} }
const app = express(); const app = express();
+2
View File
@@ -162,6 +162,8 @@ const RECAP_SCRIPT = path.join(REPO_ROOT, 'BOT', 'render_recap.py');
function resolveReplaySessionDir(sessionId) { function resolveReplaySessionDir(sessionId) {
const sid = String(sessionId).toLowerCase(); const sid = String(sessionId).toLowerCase();
const candidates = [ const candidates = [
path.join(REPLAYS_ROOT, 'SRE', sid),
path.join(REPLAYS_ROOT, 'TSS', sid),
path.join(REPLAYS_ROOT, sid), path.join(REPLAYS_ROOT, sid),
path.join(REPLAYS_ROOT, `0${sid}`), path.join(REPLAYS_ROOT, `0${sid}`),
path.join(LEGACY_REPLAYS_ROOT, sid), path.join(LEGACY_REPLAYS_ROOT, sid),