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

@ -4,7 +4,7 @@ const SocketAuthority = require('../SocketAuthority')
const fs = require('../libs/fsExtra')
const { getPodcastFeed, findMatchingEpisodes } = require('../utils/podcastUtils')
const { getFileTimestampsWithIno } = require('../utils/fileUtils')
const { getFileTimestampsWithIno, filePathToPOSIX } = require('../utils/fileUtils')
const filePerms = require('../utils/filePerms')
const LibraryItem = require('../objects/LibraryItem')
@ -30,7 +30,7 @@ class PodcastController {
return res.status(404).send('Folder not found')
}
var podcastPath = payload.path.replace(/\\/g, '/')
const podcastPath = filePathToPOSIX(payload.path)
if (await fs.pathExists(podcastPath)) {
Logger.error(`[PodcastController] Podcast folder already exists "${podcastPath}"`)
return res.status(400).send('Podcast already exists')