Tweaked the decode() templatetag code slightly.

- Legacy-Id: 18482
This commit is contained in:
Henrik Levkowetz 2020-09-09 19:05:59 +00:00
parent 638797cb65
commit 60a1e0fe3d

View file

@ -6,7 +6,7 @@ import re
from django import template from django import template
from django.conf import settings from django.conf import settings
from django.template.defaultfilters import linebreaksbr, force_escape from django.template.defaultfilters import linebreaksbr, force_escape
from django.utils.encoding import force_text from django.utils.encoding import force_text, DjangoUnicodeDecodeError
from django.utils.safestring import mark_safe from django.utils.safestring import mark_safe
import debug # pyflakes:ignore import debug # pyflakes:ignore
@ -69,7 +69,7 @@ def decrypt(string, request, year, plain=False):
encrypted_file.name), key) encrypted_file.name), key)
try: try:
out = force_text(out) out = force_text(out)
except Exception: except DjangoUnicodeDecodeError:
pass pass
if code != 0: if code != 0:
log("openssl error: %s:\n Error %s: %s" %(command, code, error)) log("openssl error: %s:\n Error %s: %s" %(command, code, error))