diff options
author | Jo-Philipp Wich <jo@mein.io> | 2019-06-05 16:01:16 +0200 |
---|---|---|
committer | Jo-Philipp Wich <jo@mein.io> | 2019-06-05 16:15:40 +0200 |
commit | 1c09ee5e42550d6339bffa58d4cba3461948e19c (patch) | |
tree | eb40c8c4adaaf2111d5b0bb18fa600006d7057a2 /applications/luci-app-wol | |
parent | 15608fd2e5283fd6dd3ee4e9bf783029d0cae8c3 (diff) |
luci-mod-system: fix SimpleForm usage on file editing pages
When a value identical to the stored one is submitted, the CBI framework
will not emit an option write event and therfore not store the value in
the form data dictionary passed to SimpleForm.handle().
This usage pattern usally works be accident for file editor views such
as admin_system/crontab because \r\n windows style line endings are
substituted with unix \n ones before writing the data, defeating the
equality check in CBI.
When a single line without trailing newline is submitted however, the
CBI will not see a difference to the data stored in the file and clear
out the value on subsequent saves.
This commit alignes the logic used by various SimpleForm views to
behave identically and predictable:
- File data is handled in the SimpleForm.handle() callback
- The forcewrite property is used to disable equality checks
- Submission of an empty string empties the backing file
Fixes: #2737
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Diffstat (limited to 'applications/luci-app-wol')
0 files changed, 0 insertions, 0 deletions