Skip to content

Default to octet-stream if mimetype detection fails. #157

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

Merged
merged 1 commit into from
Dec 1, 2015
Merged

Default to octet-stream if mimetype detection fails. #157

merged 1 commit into from
Dec 1, 2015

Conversation

postmasters
Copy link
Contributor

The function mimetypes.guess_type returns (None, None) if it fails to
find a matching extension. In that case, we should just treat the media
as application/octet-stream.

@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Nov 18, 2015
@@ -425,7 +425,11 @@ def __init__(self, filename, mimetype=None, chunksize=DEFAULT_CHUNK_SIZE,
self._filename = filename
fd = open(self._filename, 'rb')
if mimetype is None:
(mimetype, encoding) = mimetypes.guess_type(filename)
# No mimetype provided, make a guess.
(mimetype, _) = mimetypes.guess_type(filename)

This comment was marked as spam.

@nathanielmanistaatgoogle
Copy link
Contributor

Looks mostly good; thank you for the contribution!

@postmasters
Copy link
Contributor Author

Ping!

@nathanielmanistaatgoogle
Copy link
Contributor

@postmasters: your commit appears to have a different author than it does a committer; is that as you intend it to be?

@tmatsuo: want to be a second pair of eyes on this?

@postmasters
Copy link
Contributor Author

@nathanielmanistaatgoogle I don't understand your comment. Do you see a different email address being used than namnguyen at google.com? The commit should come from that address.

@nathanielmanistaatgoogle
Copy link
Contributor

@postmasters: do you see the text "postmasters committed with Nam T. Nguyen 13 days ago" when you click on the "Commits" tab of this pull request?

@postmasters
Copy link
Contributor Author

Yes. I don't understand what that line is really saying though. "Nam T. Nguyen" is me.

@nathanielmanistaatgoogle
Copy link
Contributor

Do a git log --pretty=fuller at your command line - the author is your @google.com address and the committer is your @chromium.org address.

The function mimetypes.guess_type returns (None, None) if it fails to
find a matching extension. In that case, we should just treat the media
as application/octet-stream.
@postmasters
Copy link
Contributor Author

Got it. Done.

@tmatsuo
Copy link
Contributor

tmatsuo commented Dec 1, 2015

Looks good to me too :)

nathanielmanistaatgoogle added a commit that referenced this pull request Dec 1, 2015
Default to octet-stream if mimetype detection fails.
@nathanielmanistaatgoogle nathanielmanistaatgoogle merged commit 46a8071 into googleapis:master Dec 1, 2015
@Anmol-Singh-Jaggi
Copy link

When will this be reflected in the PyPI package?

@nathanielmanistaatgoogle
Copy link
Contributor

@Anmol-Singh-Jaggi: It should be reflected in the 1.5.0 PyPI package.

@Anmol-Singh-Jaggi
Copy link

Great! :D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes This human has signed the Contributor License Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants