fixed navbar disappearing on save

Browser textarea submissions convert \n to \r\n, causing the template
comparison against DEFAULT_TEMPLATE to always fail. This saved the bare
skeleton as a custom template, overriding the default navbar.
This commit is contained in:
lichenblankie 2026-03-26 22:00:27 -07:00
parent 59d2088498
commit 212e9a017d

View file

@ -525,7 +525,7 @@ 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() != DEFAULT_TEMPLATE.strip() else "") set_setting("custom_template", template if template.strip() != DEFAULT_TEMPLATE.strip() else "")