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 });
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();