diff --git a/swh/web/api/apiresponse.py b/swh/web/api/apiresponse.py --- a/swh/web/api/apiresponse.py +++ b/swh/web/api/apiresponse.py @@ -133,7 +133,7 @@ # and render the apidoc HTML template if request.accepted_media_type == "text/html": doc_data["response_data"] = data - if data: + if data is not None: doc_data["response_data"] = json.dumps( data, cls=JSONEncoder, sort_keys=True, indent=4, separators=(",", ": ") ) diff --git a/swh/web/common/swh_templatetags.py b/swh/web/common/swh_templatetags.py --- a/swh/web/common/swh_templatetags.py +++ b/swh/web/common/swh_templatetags.py @@ -6,8 +6,6 @@ import json import re -import sentry_sdk - from django import template from django.core.serializers.json import DjangoJSONEncoder from django.utils.safestring import mark_safe @@ -40,12 +38,9 @@ The text as is otherwise. """ - try: - if 'href="' not in text: - text = re.sub(r"(http.*)", r'\1', text) - return re.sub(r'([^ <>"]+@[^ <>"]+)', r'\1', text) - except Exception as exc: - sentry_sdk.capture_exception(exc) + if 'href="' not in text: + text = re.sub(r"(http.*)", r'\1', text) + return re.sub(r'([^ <>"]+@[^ <>"]+)', r'\1', text) return text