xep_0363: Simplify Content-Type guessing.

This commit is contained in:
Emmanuel Gil Peyrot 2018-03-11 19:39:51 +01:00
parent 81dc61c55c
commit 0c6de5e972

View File

@ -10,7 +10,7 @@ import asyncio
import logging import logging
from aiohttp import ClientSession from aiohttp import ClientSession
from mimetypes import MimeTypes from mimetypes import guess_type
from slixmpp import Iq, __version__ from slixmpp import Iq, __version__
from slixmpp.plugins import BasePlugin from slixmpp.plugins import BasePlugin
@ -124,7 +124,7 @@ class XEP_0363(BasePlugin):
raise FileTooBig() raise FileTooBig()
if content_type is None: if content_type is None:
content_type = MimeTypes().guess_type(filename)[0] content_type = guess_type(filename)[0]
if content_type is None: if content_type is None:
content_type = self.default_content_type content_type = self.default_content_type