mirror of
https://github.com/aljazceru/CTFd.git
synced 2025-12-17 14:04:20 +01:00
Handle invalid JSON input in the theme settings editor (#1562)
* Handle invalid JSON input in the theme settings editor
This commit is contained in:
@@ -276,7 +276,15 @@ $(() => {
|
||||
|
||||
$("#theme-settings-button").click(function() {
|
||||
let form = $("#theme-settings-modal form");
|
||||
let data = JSON.parse(theme_settings_editor.getValue());
|
||||
let data;
|
||||
|
||||
// Ignore invalid JSON data
|
||||
try {
|
||||
data = JSON.parse(theme_settings_editor.getValue());
|
||||
} catch (e) {
|
||||
data = {};
|
||||
}
|
||||
|
||||
$.each(data, function(key, value) {
|
||||
var ctrl = form.find(`[name='${key}']`);
|
||||
switch (ctrl.prop("type")) {
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user