New submission from Daniel Watkins:

```
import mimetypes

print(mimetypes.guess_type('foo.manifest'))
mimetypes.add_type('text/plain', 'manifest')
print(mimetypes.guess_type('foo.manifest'))
```

results in:

```
('application/x-ms-manifest', None)
('application/x-ms-manifest', None)
```

I (mistakenly) expected the latter print to give me "('text/plain', None)".  It 
doesn't because I should have prepended a . to the second add_type argument.

I think add_type should error out when given an extension without a dot-prefix, 
because it's extremely unlikely that code that does so is behaving as intended 
with the current implementation.

(At the very least, documentation should be updated to make this expectation 
clearer.)

----------
components: Library (Lib)
messages: 299135
nosy: odd_bloke
priority: normal
severity: normal
status: open
title: mimetypes.add_type should complain when you give it an undotted ext

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue31040>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to