Do not raise a 500 exception when previewing empty media. (#8883)

This commit is contained in:
Patrick Cloke 2020-12-07 10:00:08 -05:00 committed by GitHub
parent 92d87c6882
commit 1f3748f033
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 22 additions and 12 deletions

View file

@ -676,7 +676,11 @@ class PreviewUrlResource(DirectServeJsonResource):
logger.debug("No media removed from url cache")
def decode_and_calc_og(body, media_uri, request_encoding=None):
def decode_and_calc_og(body, media_uri, request_encoding=None) -> Dict[str, str]:
# If there's no body, nothing useful is going to be found.
if not body:
return {}
from lxml import etree
try: