fix config
This commit is contained in:
parent
c65c0aa258
commit
b551e0c1b5
@ -18,10 +18,14 @@ interface MessyConfigType {
|
|||||||
* this should accept the result after loadData();
|
* this should accept the result after loadData();
|
||||||
*/
|
*/
|
||||||
export const messyConfigToNormal = (
|
export const messyConfigToNormal = (
|
||||||
x: MessyConfigType | RemotelySavePluginSettings
|
x: MessyConfigType | RemotelySavePluginSettings | null | undefined
|
||||||
): RemotelySavePluginSettings => {
|
): RemotelySavePluginSettings | null | undefined => {
|
||||||
log.debug("loading, original config on disk:");
|
log.debug("loading, original config on disk:");
|
||||||
log.debug(x);
|
log.debug(x);
|
||||||
|
if (x === null || x === undefined) {
|
||||||
|
log.debug("the messy config is null or undefined, skip");
|
||||||
|
return x as any;
|
||||||
|
}
|
||||||
if ("readme" in x && "d" in x) {
|
if ("readme" in x && "d" in x) {
|
||||||
// we should decode
|
// we should decode
|
||||||
const y = JSON.parse(
|
const y = JSON.parse(
|
||||||
@ -45,7 +49,13 @@ export const messyConfigToNormal = (
|
|||||||
/**
|
/**
|
||||||
* this should accept the result of original config
|
* this should accept the result of original config
|
||||||
*/
|
*/
|
||||||
export const normalConfigToMessy = (x: RemotelySavePluginSettings) => {
|
export const normalConfigToMessy = (
|
||||||
|
x: RemotelySavePluginSettings | null | undefined
|
||||||
|
) => {
|
||||||
|
if (x === null || x === undefined) {
|
||||||
|
log.debug("the normal config is null or undefined, skip");
|
||||||
|
return x;
|
||||||
|
}
|
||||||
const y = {
|
const y = {
|
||||||
readme: DEFAULT_README,
|
readme: DEFAULT_README,
|
||||||
d: reverseString(
|
d: reverseString(
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user