parse logic improvement for adding maps into mappool
This commit is contained in:
@@ -126,8 +126,10 @@ export const actions: Actions = {
|
|||||||
|
|
||||||
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+)/);
|
||||||
if (urlMatch) beatmapId = urlMatch[1];
|
if (urlMatch) beatmapId = urlMatch[1];
|
||||||
else if (setMatch) beatmapId = setMatch[1];
|
else if (setMatch) beatmapId = setMatch[1];
|
||||||
|
else if (shortMatch) beatmapId = shortMatch[1];
|
||||||
|
|
||||||
if (!/^\d+$/.test(beatmapId)) {
|
if (!/^\d+$/.test(beatmapId)) {
|
||||||
return { error: 'Invalid beatmap ID' };
|
return { error: 'Invalid beatmap ID' };
|
||||||
|
|||||||
Reference in New Issue
Block a user