mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-01-08 00:08:14 +01:00
Remove old cover method make sure cover filename is an actual image
This commit is contained in:
parent
ce35ae6b03
commit
1c6cd7499b
@ -51,11 +51,12 @@ class CoverManager {
|
||||
async removeOldCovers(dirpath, newCoverExt) {
|
||||
var filesInDir = await this.getFilesInDirectory(dirpath)
|
||||
|
||||
const imageExtensions = ['.jpeg', '.jpg', '.png', '.webp', '.jiff']
|
||||
for (let i = 0; i < filesInDir.length; i++) {
|
||||
var file = filesInDir[i]
|
||||
var _extname = Path.extname(file)
|
||||
var _extname = Path.extname(file).toLowerCase()
|
||||
var _filename = Path.basename(file, _extname)
|
||||
if (_filename === 'cover' && _extname !== newCoverExt) {
|
||||
if (_filename === 'cover' && _extname !== newCoverExt && imageExtensions.includes(_extname)) {
|
||||
var filepath = Path.join(dirpath, file)
|
||||
Logger.debug(`[CoverManager] Removing old cover from metadata "${filepath}"`)
|
||||
await this.removeFile(filepath)
|
||||
|
Loading…
Reference in New Issue
Block a user