Skip to content
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

Improve content type detection #7

Merged
merged 2 commits into from
Dec 13, 2022
Merged

Conversation

bct
Copy link
Contributor

@bct bct commented Dec 13, 2022

Fixes TypeError: cannot serialize None (type NoneType) in getAlbum when the mimetypes modules can't guess the content type.

I was running into this with FLAC albums on a server that doesn't have any of the mime.types files that mimetypes looks for.

This PR makes two changes:

  • adds a file extension -> content type mapping for common audio file formats
  • provides a clearer error message when content type detection fails

Copy link
Owner

@BinaryBrain BinaryBrain left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, right I didn't think about this edge case.
I like your solution. Thank you!

@BinaryBrain BinaryBrain merged commit 9f240bc into BinaryBrain:main Dec 13, 2022
@bct bct deleted the fix-content-type branch December 13, 2022 22:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants