Fix:Check if Windows before cleaning file path for POSIX separators #1254

This commit is contained in:
advplyr 2023-01-05 17:45:27 -06:00
parent f76f9c7f84
commit 9a85ad1f6b
19 changed files with 66 additions and 54 deletions

View file

@ -5,6 +5,7 @@ const njodb = require('../libs/njodb')
const { SupportedEbookTypes } = require('./globals')
const { PlayMethod } = require('./constants')
const { getId } = require('./index')
const { filePathToPOSIX } = require('./fileUtils')
const Logger = require('../Logger')
const Library = require('../objects/Library')
@ -87,8 +88,8 @@ function makeSeriesFromOldAb({ series, volumeNumber }) {
}
function getRelativePath(srcPath, basePath) {
srcPath = srcPath.replace(/\\/g, '/')
basePath = basePath.replace(/\\/g, '/')
srcPath = filePathToPOSIX(srcPath)
basePath = filePathToPOSIX(basePath)
return srcPath.replace(basePath, '')
}