Normalize template line endings before storing to fix navbar disappearing
The previous fix only normalized \r\n for comparison but stored the raw template with browser line endings. Now all \r\n and \r are converted to \n before both comparing and storing, preventing the bare skeleton from ever being saved as a custom template. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
6070e09834
commit
2df92752b6
1 changed files with 2 additions and 2 deletions
|
|
@ -525,10 +525,10 @@ def handle_style_form(msg=""):
|
||||||
|
|
||||||
|
|
||||||
def handle_style_submit(body):
|
def handle_style_submit(body):
|
||||||
template = body.get("template", [""])[0]
|
template = body.get("template", [""])[0].replace("\r\n", "\n").replace("\r", "\n")
|
||||||
name = body.get("site_name", ["tinyweb"])[0].strip()
|
name = body.get("site_name", ["tinyweb"])[0].strip()
|
||||||
sharing = "1" if body.get("sharing_enabled") else "0"
|
sharing = "1" if body.get("sharing_enabled") else "0"
|
||||||
set_setting("custom_template", template if template.strip().replace("\r\n", "\n") != DEFAULT_TEMPLATE.strip() else "")
|
set_setting("custom_template", template if template.strip() != DEFAULT_TEMPLATE.strip() else "")
|
||||||
set_setting("site_name", name or "tinyweb")
|
set_setting("site_name", name or "tinyweb")
|
||||||
set_setting("sharing_enabled", sharing)
|
set_setting("sharing_enabled", sharing)
|
||||||
return handle_style_form("Saved.")
|
return handle_style_form("Saved.")
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue