We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent dedab98 commit 36cc7b6Copy full SHA for 36cc7b6
src/lib/utils/contest_table_provider.ts
@@ -165,7 +165,14 @@ class ABC212ToABC318Provider extends ContestTableProviderBase {
165
}
166
167
function parseContestRound(contestId: string, prefix: string): number {
168
- return parseInt(contestId.replace(prefix, ''), 10);
+ const withoutPrefix = contestId.replace(prefix, '');
169
+
170
+ // Verify the prefix was present and the remaining string is numeric
171
+ if (withoutPrefix === contestId || !/^\d+$/.test(withoutPrefix)) {
172
+ throw new Error(`Invalid contest id has given: ${contestId}`);
173
+ }
174
175
+ return parseInt(withoutPrefix, 10);
176
177
178
// TODO: Add providers for other contest types if needs.
0 commit comments