Skip to content

Commit 6513cf7

Browse files
authored
fix: close form tag before Restore Database section to fix nested form bug
The Restore Calibre Database form (action=admin.restore_calibre_db) was nested inside the outer DB Configuration form (action=admin.db_configuration). HTML doesn't allow nested forms; browsers drop the inner <form> tag during parsing but keep its children (the CSRF input and submit button) as part of the outer form. As a result, clicking "Restore Calibre Database (Last Resort)" always submitted the outer db_configuration form instead - silently saving the basic config fields and doing nothing else, with no error and no indication anything was wrong. Fix: close the outer form right after the Save/Cancel row, before the Restore section begins, instead of wrapping the whole page in one form. The settings-container div still visually wraps both sections; only the <form> boundary changes. No other markup, styling, or route logic touched. Verified by hand: without the fix, both DevTools Network capture and container logs show every click POSTing to /admin/dbconfig with only config_calibre_dir/config_calibre_split_dir fields - /admin/restore_calibre_db is never hit. With the fix (tested by calling the intended endpoint directly), the restore runs correctly and rebuilds metadata.db from the library's OPF files.
1 parent 18d6b92 commit 6513cf7

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

cps/templates/config_db.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ <h2 style="margin-bottom: 4rem;">{{_("Split Library Functionality")}}</h2>
110110
<div id="db_submit" name="submit" class="btn btn-default">{{_('Save')}}</div>
111111
<a href="{{ url_for('admin.admin') }}" id="config_back" class="btn btn-default">{{_('Cancel')}}</a>
112112
</div>
113+
</form>
113114

114115
<hr style="margin: 3rem 0;">
115116

@@ -122,7 +123,6 @@ <h2>{{ _('Last Resort: Restore Calibre Database (experimental)') }}</h2>
122123
</form>
123124
</div>
124125
</div>
125-
</form>
126126
</div>
127127
{% endblock %}
128128
{% block modal %}

0 commit comments

Comments
 (0)