allow fo rboth cols directions

This commit is contained in:
2026-03-10 03:44:44 +01:00
parent 50aa40b3d5
commit bda1d796b0

View File

@@ -305,15 +305,26 @@ export const actions: Actions = {
continue; continue;
} }
const modCode = parts[0]; // Detect column order: mod+id or id+mod
const modMatch = modCode.match(/^(NM|HD|HR|DT|FM|TB)\d*$/i); const modRegex = /^(NM|HD|HR|DT|FM|TB)\d*$/i;
if (!modMatch) { let modCode: string;
errors.push(`Line ${lineNum}: unknown mod "${modCode}"`); let beatmapRaw: string;
if (modRegex.test(parts[0])) {
modCode = parts[0];
beatmapRaw = parts[1];
} else if (modRegex.test(parts[parts.length - 1])) {
modCode = parts[parts.length - 1];
beatmapRaw = parts[0];
} else {
errors.push(`Line ${lineNum}: no valid mod code found`);
continue; continue;
} }
const modMatch = modCode.match(modRegex)!;
const category = modMatch[1].toUpperCase(); const category = modMatch[1].toUpperCase();
let beatmapId = parts[1]; let beatmapId = beatmapRaw;
const urlMatch = beatmapId.match(/beatmaps\/(\d+)/); const urlMatch = beatmapId.match(/beatmaps\/(\d+)/);
const setMatch = beatmapId.match(/beatmapsets\/\d+#\w+\/(\d+)/); const setMatch = beatmapId.match(/beatmapsets\/\d+#\w+\/(\d+)/);
const shortMatch = beatmapId.match(/\/b\/(\d+)/); const shortMatch = beatmapId.match(/\/b\/(\d+)/);