Skip to content
Snippets Groups Projects
Commit 418720e6 authored by vlorentz's avatar vlorentz Committed by vlorentz
Browse files

dart: Fix crash on yaml parser error

parent c33bb27e
No related branches found
No related tags found
1 merge request!485dart: Fix crash on yaml parser error
Pipeline #1409 passed
......@@ -400,7 +400,7 @@ class YamlMapping(DictMapping):
raw_content_string: str = raw_content.decode()
try:
content_dict = yaml.load(raw_content_string, Loader=SafeLoader)
except yaml.scanner.ScannerError:
except (yaml.scanner.ScannerError, yaml.parser.ParserError):
return None
if isinstance(content_dict, dict):
......
......@@ -148,3 +148,14 @@ def test_normalize_empty_authors():
}
assert result == expected
def test_invalid_yaml():
raw_content = b"""
name: smartech_push
license: { :type => "Commercial", :file => "LICENSE" }
"""
result = MAPPINGS["PubMapping"]().translate(raw_content)
assert result is None
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment