Browse Source

Merge branch 'bypass-mime-verification' of Zykino/prismedia into develop

Add feature to overriding the Mime type check for .mp4 when the user is sure of its file
pull/51/head
LecygneNoir 4 years ago
committed by Gogs
parent
commit
4e20d9efc4
1 changed files with 10 additions and 4 deletions
  1. +10
    -4
      prismedia/upload.py

+ 10
- 4
prismedia/upload.py View File

@ -115,10 +115,16 @@ VALID_LANGUAGES = ('arabic', 'english', 'french',
def validateVideo(path):
supported_types = ['video/mp4']
if magic.from_file(path, mime=True) in supported_types:
return path
else:
return False
detected_type = magic.from_file(path, mime=True)
if detected_type not in supported_types:
print("File", path, "detected type is", detected_type, "which is not one of", supported_types)
force_file = ['y', 'yes']
is_forcing = input("Are you sure you selected the correct file? (y/N)")
if is_forcing.lower() not in force_file:
return False
return path
def validateCategory(category):

Loading…
Cancel
Save