mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-08-04 10:14:36 +02:00
Fix:Set correct mime type for m4b file static requests
This commit is contained in:
parent
6cbfd8679b
commit
976427b0b3
4 changed files with 24 additions and 13 deletions
|
@ -3,6 +3,7 @@ const rra = require('../libs/recursiveReaddirAsync')
|
|||
const axios = require('axios')
|
||||
const Path = require('path')
|
||||
const Logger = require('../Logger')
|
||||
const { AudioMimeType } = require('./constants')
|
||||
|
||||
async function getFileStat(path) {
|
||||
try {
|
||||
|
@ -211,3 +212,11 @@ module.exports.sanitizeFilename = (filename, colonReplacement = ' - ') => {
|
|||
|
||||
return sanitized
|
||||
}
|
||||
|
||||
// Returns null if extname is not in our defined list of audio extnames
|
||||
module.exports.getAudioMimeTypeFromExtname = (extname) => {
|
||||
if (!extname || !extname.length) return null
|
||||
const formatUpper = extname.slice(1).toUpperCase()
|
||||
if (AudioMimeType[formatUpper]) return AudioMimeType[formatUpper]
|
||||
return null
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue