Skip to content

Commit fed8209

Browse files
authored
[Feature:Plagiarism] Add mime type check (#81)
* add mime type check * fix whitespace
1 parent 6f39cd7 commit fed8209

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

bin/concatenate_all.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
import humanize
1313
import fnmatch
1414
import hashlib
15+
import mimetypes
1516
from pathlib import Path
1617

1718
IGNORED_FILES = [
@@ -49,6 +50,12 @@ def getConcatFilesInDir(input_dir, regex_patterns):
4950
# exclude any files we have ignored for all submissions
5051
if my_file in IGNORED_FILES:
5152
continue
53+
54+
# check for MIME types which are not supported
55+
file_type = mimetypes.guess_type(my_file)[0]
56+
if file_type.endswith("/pdf") or file_type.startswith("image/"):
57+
continue
58+
5259
absolute_path = os.path.join(my_dir, my_file)
5360
# print a separator & filename
5461
with open(absolute_path, encoding='ISO-8859-1') as tmp:

0 commit comments

Comments
 (0)