The submit form accepts the languages it offers - #100
Merged
Conversation
Its file field took `.cpp`, `.cc`, `.py` and `.txt`. The catalogue behind the select has eight C toolchains that accept `.c` and nothing else, so a C solution could be pasted and never uploaded — and `.txt` is refused by every toolchain of this type. The list moves next to the catalogue it has to agree with, and `check:languages` holds them together.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The submit form's file field accepted
.cpp,.cc,.pyand.txt. The catalogue behind its own language select has eight C toolchains, and every one of them accepts.cand nothing else — so choosing C11 (GCC) and uploadingmain.cwas refused by the form in front of the Runner, with "Dozwolone rozszerzenia: .cpp, .cc, .py, .txt". A C solution could be pasted into the editor and never uploaded as a file..txtwas wrong the other way: no toolchain of this type accepts it, so the form offered a file the Runner would have refused as a compilation error.Found by submitting a C program through the real screen, which is the only place it shows: the select and the file field are set from two different lists in two different files, and nothing compared them.
The change
The accept lists move into
src/components/editor/languages.ts, beside the catalogue they have to agree with, andsrc/renderers/index.tsasks for them.standard-io@1now takes.c,.cpp,.cc,.cxx,.c++and.py— every extension the Runner accepts for a toolchain of this type, and none it does not.Deliberately a superset of any one toolchain's own extensions: the browser's filter is a convenience and the Runner is the gate, so narrowing it to the chosen language would only hide a file somebody legitimately renamed, while the real refusal still arrives with a message naming what that toolchain takes.
What checks it
npm run check:languages, new, and in CI besidecheck:package. It compileslanguages.ts— which imports nothing — and asserts both directions: every toolchain the form offers has an extension it can be uploaded under, and nothing is offered that no toolchain would take.Sabotaged before it was believed. Putting the old list back:
CLAUDE.md's step table and count are updated with it, asci.ymlasks.