Commit ffb4c56b authored by 郭阔's avatar 郭阔

fix(panel): wrap default_conf_dir in Path for plan config writes

schedule-intent/schedule-gap concatenated str / str (default_conf_dir
returns str) → 500 on save; schedule_board already wrapped its copy.
parent 188d65b3
...@@ -1397,7 +1397,7 @@ def schedule_intent(): ...@@ -1397,7 +1397,7 @@ def schedule_intent():
return redirect(url_for("schedule_board")) return redirect(url_for("schedule_board"))
if window and window not in ("morning", "afternoon", "evening"): if window and window not in ("morning", "afternoon", "evening"):
window = "" window = ""
conf_path = pl.default_conf_dir(pl.default_work_dir()) / "schedule-plan.json" conf_path = Path(pl.default_conf_dir(pl.default_work_dir())) / "schedule-plan.json"
try: try:
conf = json.loads(Path(conf_path).read_text(encoding="utf-8")) conf = json.loads(Path(conf_path).read_text(encoding="utf-8"))
except (OSError, ValueError): except (OSError, ValueError):
...@@ -1431,7 +1431,7 @@ def schedule_gap(): ...@@ -1431,7 +1431,7 @@ def schedule_gap():
if g not in (10, 15, 20, 25, 30, 40, 45, 60, 90, 120): if g not in (10, 15, 20, 25, 30, 40, 45, 60, 90, 120):
flash("间隔值不合法(可选 10/15/20/25/30/40/45/60/90/120 分钟)", "error") flash("间隔值不合法(可选 10/15/20/25/30/40/45/60/90/120 分钟)", "error")
return redirect(url_for("schedule_board")) return redirect(url_for("schedule_board"))
conf_path = pl.default_conf_dir(pl.default_work_dir()) / "schedule-plan.json" conf_path = Path(pl.default_conf_dir(pl.default_work_dir())) / "schedule-plan.json"
try: try:
conf = json.loads(Path(conf_path).read_text(encoding="utf-8")) conf = json.loads(Path(conf_path).read_text(encoding="utf-8"))
except (OSError, ValueError): except (OSError, ValueError):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment