Skip to content

Commit

Permalink
one more place
Browse files Browse the repository at this point in the history
  • Loading branch information
bdraco committed Dec 4, 2024
1 parent 8851a0b commit 851fcbc
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion aiohttp/payload.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import json
import mimetypes
import os
import sys
import warnings
from abc import ABC, abstractmethod
from itertools import chain
Expand Down Expand Up @@ -169,7 +170,11 @@ def __init__(
assert isinstance(content_type, str)
self._headers[hdrs.CONTENT_TYPE] = content_type
elif self._filename is not None:
content_type = mimetypes.guess_type(self._filename)[0]
if sys.version_info >= (3, 13):
guesser = mimetypes.guess_file_type
else:
guesser = mimetypes.guess_type
content_type = guesser(self._filename)[0]
if content_type is None:
content_type = self._default_content_type
self._headers[hdrs.CONTENT_TYPE] = content_type
Expand Down

0 comments on commit 851fcbc

Please sign in to comment.