From 79301d7be3d5a95146516b2c708375978468d7f4 Mon Sep 17 00:00:00 2001 From: Aevann Date: Thu, 11 Apr 2024 15:41:59 +0200 Subject: [PATCH] fix 500 error --- files/helpers/media.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/files/helpers/media.py b/files/helpers/media.py index bdd577021..0395cfcca 100644 --- a/files/helpers/media.py +++ b/files/helpers/media.py @@ -170,6 +170,7 @@ def process_video(file, v): try: video_info = ffmpeg.probe(old)['streams'] + codec = None for stream in video_info: if stream["codec_type"] == "video": codec = stream['codec_name'] @@ -179,6 +180,10 @@ def process_video(file, v): os.remove(old) abort(400, "Something went wrong processing your video on our end. Please try uploading it to https://pomf2.lain.la and post the link instead.") + if not codec: + os.remove(old) + abort(400, "Something went wrong processing your video on our end. Please try uploading it to https://pomf2.lain.la and post the link instead.") + is_reencoding = False if codec != 'h264': copyfile(old, new)