Fix yaml parsing
This commit is contained in:
@@ -334,12 +334,9 @@ class CustomSettings(object):
|
||||
|
||||
|
||||
def load_yaml(path):
|
||||
try:
|
||||
return yaml.load(path, Loader=yaml.SafeLoader)
|
||||
except yaml.YAMLError as exc:
|
||||
if os.path.exists(Path(path)):
|
||||
with open(path, "r", encoding="utf-8") as f:
|
||||
return yaml.load(f, Loader=yaml.SafeLoader)
|
||||
elif urllib.parse.urlparse(path).scheme in ['http', 'https']:
|
||||
return yaml.load(urllib.request.urlopen(path), Loader=yaml.FullLoader)
|
||||
if os.path.exists(Path(path)):
|
||||
with open(path, "r", encoding="utf-8") as f:
|
||||
return yaml.load(f, Loader=yaml.SafeLoader)
|
||||
elif urllib.parse.urlparse(path).scheme in ['http', 'https']:
|
||||
return yaml.load(urllib.request.urlopen(path), Loader=yaml.FullLoader)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user