Skip to content

Commit

Permalink
fix: 修复 YAML 处理 undefined 的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
xream committed Oct 18, 2024
1 parent 27e693c commit 7228698
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion backend/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "sub-store",
"version": "2.14.400",
"version": "2.14.401",
"description": "Advanced Subscription Manager for QX, Loon, Surge, Stash and ShadowRocket.",
"main": "src/main.js",
"scripts": {
Expand Down
12 changes: 6 additions & 6 deletions backend/src/utils/yaml.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,16 @@ function retry(fn, content, ...args) {
}

export function safeLoad(content, ...args) {
return retry(YAML.safeLoad, content, ...args);
return retry(YAML.safeLoad, JSON.parse(JSON.stringify(content)), ...args);
}
export function load(content, ...args) {
return retry(YAML.load, content, ...args);
return retry(YAML.load, JSON.parse(JSON.stringify(content)), ...args);
}
export function safeDump(...args) {
return YAML.safeDump(...args);
export function safeDump(content, ...args) {
return YAML.safeDump(JSON.parse(JSON.stringify(content)), ...args);
}
export function dump(...args) {
return YAML.dump(...args);
export function dump(content, ...args) {
return YAML.dump(JSON.parse(JSON.stringify(content)), ...args);
}

export default {
Expand Down

0 comments on commit 7228698

Please sign in to comment.