8000 gh-75223: Reject undotted extensions in mimetypes.add_type by OddBloke · Pull Request #2895 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-75223: Reject undotted extensions in mimetypes.add_type #2895

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 13 commits into
base: main
Choose a base branch
from
Draft
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Improve wording: avoid triple negative
  • Loading branch information
hugovk committed Nov 16, 2024
commit 50179cf3c0a3c523cb8fe958494e22f98fbb37da
5 changes: 2 additions & 3 deletions Lib/mimetypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,8 @@ def add_type(self, type, ext, strict=True):
list of standard types, else to the list of non-standard
types.

Non-empty extensions that don't start with a '.' are not
valid, so a ValueError will be raised if they are
specified.
Valid extensions are empty or start with a '.'.
Raise a ValueError for invalid extensions.
"""
if ext and not ext.startswith('.'):
raise ValueError("Extensions should start with a '.' or be empty")
Expand Down
Loading
0