mirror of
https://github.com/vee1e/mitmproxy.git
synced 2026-09-04 11:47:14 +00:00
[web] Fix conflict.
This commit is contained in:
parent
4282dc1ac4
commit
6ae0f07e70
2 changed files with 8 additions and 12 deletions
|
|
@ -512,15 +512,14 @@ def serialize(opts, text, defaults=False):
|
|||
return ruamel.yaml.round_trip_dump(data)
|
||||
|
||||
|
||||
def save(opts, path=None, defaults=False):
|
||||
def save(opts, path, defaults=False):
|
||||
"""
|
||||
If the path is given, save to path, otherwise return the serialized data.
|
||||
|
||||
If the destination file exists, modify it in-place.
|
||||
Save to path. If the destination file exists, modify it in-place.
|
||||
|
||||
Raises OptionsError if the existing data is corrupt.
|
||||
"""
|
||||
if path and os.path.exists(path) and os.path.isfile(path):
|
||||
path = os.path.expanduser(path)
|
||||
if os.path.exists(path) and os.path.isfile(path):
|
||||
with open(path, "rt", encoding="utf8") as f:
|
||||
try:
|
||||
data = f.read()
|
||||
|
|
@ -531,9 +530,5 @@ def save(opts, path=None, defaults=False):
|
|||
else:
|
||||
data = ""
|
||||
data = serialize(opts, data, defaults)
|
||||
|
||||
if path:
|
||||
with open(path, "wt", encoding="utf8") as f:
|
||||
f.write(data)
|
||||
else:
|
||||
return data
|
||||
with open(path, "wt", encoding="utf8") as f:
|
||||
f.write(data)
|
||||
|
|
|
|||
|
|
@ -21,7 +21,8 @@ from mitmproxy import optmanager
|
|||
from mitmproxy import options
|
||||
import mitmproxy.tools.web.master # noqa
|
||||
|
||||
CONFIG_PATH = os.path.expanduser(os.path.join(options.CA_DIR, 'config.yaml'))
|
||||
CONFIG_PATH = os.path.join(options.CA_DIR, 'config.yaml')
|
||||
|
||||
|
||||
def flow_to_json(flow: mitmproxy.flow.Flow) -> dict:
|
||||
"""
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue