-
-
Notifications
You must be signed in to change notification settings - Fork 11
Description
describe the bug
Language autodetection detects the language not listed in the language dropdown (when creating/editing pasty)
For example, the following C code:
#include <stdio.h>
int main() {
printf("Hello, world!\n");
return 0;
}is detected as Yacc (Example: https://paste.myst.rs/h1twkz21) and will prevent the language of the pasty being changed and prevents the content from being saved.
However, everything works as expected when the pasty is explicitly set to be the C programming language.
errors
Upon initially loading the edit page of the problematic paste, The following error will occur within the console:
Uncaught (in promise) TypeError: can't access property "value", that is null
setValue https://paste.myst.rs/static/scripts/components/dropdown.js:171
resetValue https://paste.myst.rs/static/scripts/components/dropdown.js:201
setupLanguageDropdown https://paste.myst.rs/static/scripts/components/pastyEditor.js:225
initEditors https://paste.myst.rs/static/scripts/components/pastyEditor.js:37
<anonymous> https://paste.myst.rs/static/scripts/pages/editPaste.js?v=2.8.4:7
EventListener.handleEvent* https://paste.myst.rs/static/scripts/pages/editPaste.js?v=2.8.4:5
And when attempting to change the value of the language dropdown, the following will occur:
Uncaught TypeError: can't access property "checked", this.checked is null
setValue https://paste.myst.rs/static/scripts/components/dropdown.js:176
updateValue https://paste.myst.rs/static/scripts/components/dropdown.js:160
addEventListeners https://paste.myst.rs/static/scripts/components/dropdown.js:26
addEventListeners https://paste.myst.rs/static/scripts/components/dropdown.js:20
Dropdown https://paste.myst.rs/static/scripts/components/dropdown.js:13
setupLanguageDropdown https://paste.myst.rs/static/scripts/components/pastyEditor.js:223
initEditors https://paste.myst.rs/static/scripts/components/pastyEditor.js:37
<anonymous> https://paste.myst.rs/static/scripts/pages/editPaste.js?v=2.8.4:7
EventListener.handleEvent* https://paste.myst.rs/static/scripts/pages/editPaste.js?v=2.8.4:5
No error will occur when the save button is pressed.
to reproduce
steps to reproduce the behavior:
- Log in
- Create a paste (can use the code above as an example)
- Try to edit it
- Can't change the language of the pasty nor save the edits to the text content (Nothing happens after pressing "Save")
expected behavior
The language of the pasty is changed, and the changes to the content are saved.
screenshots
if applicable, add screenshots to help explain your problem.
device and browser:
- os: Linux
- browser: Firefox
- browser version: 144.0 (64-bit)
additional context
Another problematic paste as an example: https://paste.myst.rs/gorxhjf7