Skip to content

Commit

Permalink
馃帹 Protect agains null scripts sent by client
Browse files Browse the repository at this point in the history
See #3827
  • Loading branch information
foosel committed Nov 30, 2020
1 parent 5cb2564 commit ba27cdf
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/octoprint/server/api/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

from flask import abort, jsonify, make_response, request
from flask_login import current_user
from past.builtins import basestring
from werkzeug.exceptions import BadRequest

import octoprint.plugin
Expand Down Expand Up @@ -932,6 +933,8 @@ def _saveSettings(data):
for name, script in data["scripts"]["gcode"].items():
if name == "snippets":
continue
if not isinstance(script, basestring):
continue
s.saveScript(
"gcode", name, script.replace("\r\n", "\n").replace("\r", "\n")
)
Expand Down

0 comments on commit ba27cdf

Please sign in to comment.