diff --git a/gcp/website/frontend_emulator.py b/gcp/website/frontend_emulator.py
index 98018b8c3ec..0a49a64beab 100644
--- a/gcp/website/frontend_emulator.py
+++ b/gcp/website/frontend_emulator.py
@@ -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
diff --git a/gcp/website/frontend_handlers.py b/gcp/website/frontend_handlers.py
index 57cf65171cf..f1e6ea550ad 100644
--- a/gcp/website/frontend_handlers.py
+++ b/gcp/website/frontend_handlers.py
@@ -834,6 +834,9 @@ def sort_versions(versions: list[str], ecosystem: str) -> list[str]:
# with
#
_URL_MARKDOWN_REPLACER = re.compile(r'()')
+_ANCHOR_TAG_REPLACER = re.compile(
+ r']*name=["\'][^"\']*["\'][^>]*>\s*|]*name=["\'][^"\']*["\'][^>]*/>', # pylint: disable=line-too-long
+ re.IGNORECASE)
@blueprint.app_template_filter('markdown')
@@ -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