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

Fix getMediaType logic #51

Merged
merged 2 commits into from
Jul 9, 2018
Merged

Fix getMediaType logic #51

merged 2 commits into from
Jul 9, 2018

Conversation

btzr-io
Copy link
Contributor

@btzr-io btzr-io commented Jul 4, 2018

Changes

  • Improve media type detection of files with a contentType similar to application/something

Example

Most files don't follow a standar mime-type.
A simple .pdf file can contain a vendor-specific mime-type:

 PDF -> application/x-pdf, application/pdf, application/octet-stream

Usage

Before:

  const mediaType =
    (fileInfo && Lbry.getMediaType(null, fileInfo.file_name)) || Lbry.getMediaType(contentType);

After:

  const extname = path.extname(fileName) || mime.getExtension(contenType);
  const mediaType = Lbry.getMediaType(contentType, extname);

Required by:
lbryio/lbry-desktop#1576
lbryio/lbry-desktop#1558

@neb-b neb-b merged commit 189b11a into lbryio:master Jul 9, 2018
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