diff --git a/cvat/apps/engine/media_extractors.py b/cvat/apps/engine/media_extractors.py index 89a12bab8c52..018671e1b173 100644 --- a/cvat/apps/engine/media_extractors.py +++ b/cvat/apps/engine/media_extractors.py @@ -225,7 +225,9 @@ def _is_video(path): def _is_image(path): mime = mimetypes.guess_type(path) - return mime[0] is not None and mime[0].startswith('image') + # Exclude vector graphic images because Pillow cannot work with them + return mime[0] is not None and mime[0].startswith('image') and \ + not mime[0].startswith('image/svg') def _is_dir(path): return os.path.isdir(path) diff --git a/cvat/apps/engine/task.py b/cvat/apps/engine/task.py index 7d1fbd188953..f29a31351fba 100644 --- a/cvat/apps/engine/task.py +++ b/cvat/apps/engine/task.py @@ -166,7 +166,12 @@ def _validate_data(data): def count_files(file_mapping, counter): for rel_path, full_path in file_mapping.items(): mime = get_mime(full_path) - counter[mime].append(rel_path) + if mime in counter: + counter[mime].append(rel_path) + else: + slogger.glob.warn("Skip '{}' file (its mime type doesn't " + "correspond to a video or an image file)".format(full_path)) + counter = { media_type: [] for media_type in MEDIA_TYPES.keys() }