mirror of
https://github.com/zulip/zulip.git
synced 2025-10-22 20:42:14 +00:00
markdown: Use re-exported guess_type to ensure adding EXTRA_MIME_TYPES.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
committed by
Tim Abbott
parent
66466760a0
commit
b8f8056f56
@@ -52,6 +52,19 @@ rules:
|
||||
languages: [python]
|
||||
severity: ERROR
|
||||
|
||||
- id: use-wrapped-mimetypes
|
||||
pattern-either:
|
||||
- pattern: mimetypes.guess_type
|
||||
- pattern: mimetypes.guess_file_type
|
||||
- pattern: mimetypes.guess_all_extensions
|
||||
- pattern: mimetypes.guess_extension
|
||||
message: Use zerver.lib.mime_types (to ensure our EXTRA_MIME_TYPES are added)
|
||||
languages: [python]
|
||||
severity: ERROR
|
||||
paths:
|
||||
exclude:
|
||||
- zerver/lib/mime_types.py
|
||||
|
||||
- id: dont-import-models-in-migrations
|
||||
patterns:
|
||||
- pattern-not: from zerver.lib.migrate import $X
|
||||
|
@@ -1,7 +1,6 @@
|
||||
# Zulip's main Markdown implementation. See docs/subsystems/markdown.md for
|
||||
# detailed documentation on our Markdown syntax.
|
||||
import logging
|
||||
import mimetypes
|
||||
import re
|
||||
import time
|
||||
from collections import deque
|
||||
@@ -1032,7 +1031,7 @@ class InlineInterestingLinkProcessor(markdown.treeprocessors.Treeprocessor):
|
||||
if not self.zmd.image_preview_enabled:
|
||||
return False
|
||||
|
||||
url_type = mimetypes.guess_type(url)[0]
|
||||
url_type = guess_type(url)[0]
|
||||
# Support only video formats (containers) that are supported cross-browser and cross-device. As per
|
||||
# https://developer.mozilla.org/en-US/docs/Web/Media/Formats/Containers#index_of_media_container_formats_file_types
|
||||
# MP4 and WebM are the only formats that are widely supported.
|
||||
|
Reference in New Issue
Block a user