File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -157,10 +157,10 @@ def is_vid_path_valid(video_path):
157
157
# vid path is actually a URL, check it
158
158
if video_path .startswith ('http://' ) or video_path .startswith ('https://' ):
159
159
response = requests .head (video_path , allow_redirects = True )
160
- extension = video_path .rsplit ('?' , 1 )[0 ] # remove query string before checking file format extension.
160
+ extension = extension .rsplit ('?' , 1 )[0 ] # remove query string before checking file format extension.
161
161
content_disposition = response .headers .get ('Content-Disposition' )
162
- if content_disposition :
163
- # Attempt to extract the filename from the Content-Disposition header
162
+ if content_disposition and extension not in file_formats :
163
+ # Filename doesn't look valid, but perhaps the content disposition will say otherwise?
164
164
match = re .search (r'filename="?(?P<filename>[^"]+)"?' , content_disposition )
165
165
if match :
166
166
extension = match .group ('filename' ).rsplit ('.' , 1 )[- 1 ].lower ()
You can’t perform that action at this time.
0 commit comments