Verified Commit 72085596 authored by Benjamin "Ziirish" SANS's avatar Benjamin "Ziirish" SANS
Browse files

fix: don't screw up configuration files (fix #333)

parent 4d73ae8a
Pipeline #1826 passed with stages
in 23 minutes and 19 seconds
......@@ -24,6 +24,7 @@ Current
- Fix: wrong command suggestion `#296 <https://git.ziirish.me/ziirish/burp-ui/issues/296>`__
- Fix: allow templates removal `#290 <https://git.ziirish.me/ziirish/burp-ui/issues/290>`__
- Fix: don't preload LDAP users `#270 <https://git.ziirish.me/ziirish/burp-ui/issues/270>`__
- Fix: don't screw up configuration files `#333 <https://git.ziirish.me/ziirish/burp-ui/issues/333>`__
- Fix: issue `#268 <https://git.ziirish.me/ziirish/burp-ui/issues/268>`_
- `Full changelog <https://git.ziirish.me/ziirish/burp-ui/compare/0.6.0...master>`__
......
......@@ -1301,8 +1301,9 @@ class File(dict):
(key == 'password_check' or 'password' not in key):
if self._line_is_comment(line) and key in data:
result.append(self._format_key(key, data))
ridx = newkeys.index(key)
del newkeys[ridx]
if key in newkeys:
ridx = newkeys.index(key)
del newkeys[ridx]
continue
# The line was a comment and there was a further
# matching setting, so we just jump to the
......@@ -1361,6 +1362,9 @@ class File(dict):
fil.write('\n'.join(result))
except Exception as exp:
# something went wrong, we revert to the last file
with codecs.open(dest, 'w', 'utf-8', errors='ignore') as fil:
fil.writelines(orig)
return [[NOTIF_ERROR, str(exp)]]
self.parse(True)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment