VNOI-Admin / OJ

A modern open-source online judge and contest platform system.
https://oj.vnoi.info
GNU Affero General Public License v3.0
153 stars 67 forks source link

Split the old regex into smaller regex's #351

Closed jalsol closed 9 months ago

jalsol commented 10 months ago

Description

Split the old regex into smaller regex's

Type of change: bug fix, refactor

What

Instead of using a single regex, the check will go through 3 different regex's. The order of checking is:

Why

The current regex cannot check correctly in some cases.

For example, if the test structure is test[number]/in[*].out, the old check will capture [number].in and the file will pass as an input file (while it should not).

image

There is also a check whether all files are in the same format. Some files will be recognized as an input/output file of one format but not another. For example, TEST01/inftrain.out will be recognized as an input file instead, from the DMOJ regex. This is why this check is in place, and the DMOJ regex is put at the end as the fallback regex.

How Has This Been Tested?

On local version of VNOJ.

Tested with:

NOTE: Localization has not been updated.

Checklist

By submitting this pull request, I confirm that my contribution is made under the terms of the AGPL-3.0 License.