mirror of
https://github.com/smogon/pokemon-showdown.git
synced 2026-10-02 06:07:10 -05:00
Helptickets: Adjust battle/replay regexes to check word boundaries
This fixes a bug where the regex would see 'battle-gen8monotyperandombattle-numbers-pw' and would extract 2 urls; the 'battle-gen8monotyperandombattle-numbers-pw' and the 'battle-numbers-pw' from the end. The word boundary ensures it won't match within the format.
This commit is contained in:
@@ -7,9 +7,9 @@ import type {PartialModlogEntry, ModlogID} from '../modlog';
|
||||
const TICKET_FILE = 'config/tickets.json';
|
||||
const TICKET_CACHE_TIME = 24 * 60 * 60 * 1000; // 24 hours
|
||||
const TICKET_BAN_DURATION = 48 * 60 * 60 * 1000; // 48 hours
|
||||
const BATTLES_REGEX = /battle-(?:[a-z0-9]+)-(?:[0-9]+)(?:-[a-z0-9]+pw)?/g;
|
||||
const BATTLES_REGEX = /\bbattle-(?:[a-z0-9]+)-(?:[0-9]+)(?:-[a-z0-9]{31}pw)?/g;
|
||||
const REPLAY_REGEX = new RegExp(
|
||||
`${Utils.escapeRegex(Config.routes.replays)}/(?:[a-z0-9]-)?(?:[a-z0-9]+)-(?:[0-9]+)(?:-[a-z0-9]+pw)?`, "g"
|
||||
`${Utils.escapeRegex(Config.routes.replays)}/(?:[a-z0-9]-)?(?:[a-z0-9]+)-(?:[0-9]+)(?:-[a-z0-9]{31}pw)?`, "g"
|
||||
);
|
||||
|
||||
Punishments.addPunishmentType({
|
||||
|
||||
Reference in New Issue
Block a user