mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2026-05-14 15:31:29 +00:00
fix: set correct Content-Type for RSS feed audio files
Express's mime package does not recognize .m4b, causing it to fall back to application/octet-stream. This reuses the existing getAudioMimeTypeFromExtname utility (already applied to the download endpoint) to set the correct audio/mp4 header before sendFile. Fixes #5041
This commit is contained in:
parent
47457ee1e7
commit
40869bcf39
1 changed files with 6 additions and 0 deletions
|
|
@ -2,6 +2,7 @@ const { Request, Response } = require('express')
|
|||
const Path = require('path')
|
||||
|
||||
const Logger = require('../Logger')
|
||||
const { getAudioMimeTypeFromExtname } = require('../utils/fileUtils')
|
||||
const SocketAuthority = require('../SocketAuthority')
|
||||
const Database = require('../Database')
|
||||
|
||||
|
|
@ -216,6 +217,11 @@ class RssFeedManager {
|
|||
res.sendStatus(404)
|
||||
return
|
||||
}
|
||||
// Express does not set the correct mimetype for m4b files so use our defined mimetypes if available
|
||||
const audioMimeType = getAudioMimeTypeFromExtname(Path.extname(episodePath))
|
||||
if (audioMimeType) {
|
||||
res.setHeader('Content-Type', audioMimeType)
|
||||
}
|
||||
res.sendFile(episodePath)
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue