Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions gcp/website/frontend_emulator.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,9 @@ def _dict_to_vuln(data: object,
if not vuln_id:
return None

vulnerability = vulnerability_pb2.Vulnerability()
try:
json_format.ParseDict(data, vulnerability, ignore_unknown_fields=True)
vulnerability = sources.parse_vulnerability_from_dict(
data, strict=False)
except Exception as error:
print(f'[emulator] Failed to convert entry in {path}: {error}')
return None
Expand Down
6 changes: 6 additions & 0 deletions gcp/website/frontend_handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -834,6 +834,9 @@ def sort_versions(versions: list[str], ecosystem: str) -> list[str]:
# with
# <a href="https://chromium.googlesource.com/v8/v8.git/+/refs/heads/beta">
_URL_MARKDOWN_REPLACER = re.compile(r'(<a href=\".*?)(/ /)(.*?\">)')
_ANCHOR_TAG_REPLACER = re.compile(
r'<a\s+[^>]*name=["\'][^"\']*["\'][^>]*>\s*</a>|<a\s+[^>]*name=["\'][^"\']*["\'][^>]*/>', # pylint: disable=line-too-long
re.IGNORECASE)


@blueprint.app_template_filter('markdown')
Expand All @@ -852,6 +855,9 @@ def markdown(text):
# space rather than %2B
# See: https://github.com/trentm/python-markdown2/issues/621
md = _URL_MARKDOWN_REPLACER.sub(r'\1/+/\3', md)
# Removes empty anchor tags that cause visual artifacts in rendered markdown
# See: https://github.com/google/osv.dev/issues/4237
md = _ANCHOR_TAG_REPLACER.sub('', md)

return md

Expand Down
Loading