diff --git a/web/config.py b/web/config.py index 85cc9a6..ef0102f 100644 --- a/web/config.py +++ b/web/config.py @@ -33,7 +33,7 @@ def edit(name): return flask.Response('forbidden', status=403, mimetype='text/plain') if flask.request.method == 'POST': form = flask.request.form - db.save(name, json.loads(form.get('text'))) + db.save(name, json.loads(form.get('text').replace('\r\n', '\n'))) system.run(system.save_config) content = json.dumps(db.load(name), indent=2) return flask.render_template('config/edit.html', **locals()) diff --git a/web/rules.py b/web/rules.py index abc87cf..eacc9f0 100644 --- a/web/rules.py +++ b/web/rules.py @@ -43,7 +43,7 @@ def edit(index): form = flask.request.form rules = db.read('rules') rules[index]['name'] = form.get('name') - rules[index]['text'] = form.get('text') + rules[index]['text'] = form.get('text').replace('\r\n', '\n') rules[index]['managers'] = [m for m in form.getlist('manager') if m] db.write('rules', rules) system.run(system.save_config)