Closed e3rd closed 4 years ago
This PR is just an example. It is not meant to be merged.
File: runtime.conf\saveFormData()
try {
value = JSON.parse(valueInput.value); // In order '{"time.source":"\*"}' would be treated as an object,
// we have to translate it to '{"time.source":"\\*"}' first.
// In the runtime.conf, it will appear as '{"time.source":"\\*"}'
// which is identical to the raw string '{"time.source": r"\*"}'.
value = JSON.parse(valueInput.value.replace(/\\/g,'\\\\'));
} catch (err) { } catch (err) {
value = valueInput.value; value = valueInput.value;
} }
Doubles all backslashes in the bot dict-like parameters.
In order
{"time.source":"\*"}
would be treated as an object, we have to translate it to{"time.source":"\\*"}
first. In web console, it will appear as{"time.source":"\*"}
, whereas in the runtime.conf, it will appear as{"time.source":"\\*"}
which is identical to the raw string{"time.source": r"\*"}
.