mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-01-03 00:06:46 +01:00
Fix path normalization to support UNC paths
This commit is contained in:
parent
2c8ebd43cc
commit
d72e0a4418
@ -15,7 +15,7 @@ const { AudioMimeType } = require('./constants')
|
|||||||
*/
|
*/
|
||||||
const filePathToPOSIX = (path) => {
|
const filePathToPOSIX = (path) => {
|
||||||
if (!global.isWin || !path) return path
|
if (!global.isWin || !path) return path
|
||||||
return path.replace(/\\/g, '/')
|
return path.startsWith('\\\\') ? '\\\\' + path.slice(2).replace(/\\/g, '/') : path.replace(/\\/g, '/')
|
||||||
}
|
}
|
||||||
module.exports.filePathToPOSIX = filePathToPOSIX
|
module.exports.filePathToPOSIX = filePathToPOSIX
|
||||||
|
|
||||||
@ -169,7 +169,7 @@ async function recurseFiles(path, relPathToReplace = null) {
|
|||||||
extensions: true,
|
extensions: true,
|
||||||
deep: true,
|
deep: true,
|
||||||
realPath: true,
|
realPath: true,
|
||||||
normalizePath: true
|
normalizePath: false
|
||||||
}
|
}
|
||||||
let list = await rra.list(path, options)
|
let list = await rra.list(path, options)
|
||||||
if (list.error) {
|
if (list.error) {
|
||||||
@ -186,6 +186,8 @@ async function recurseFiles(path, relPathToReplace = null) {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
item.fullname = filePathToPOSIX(item.fullname)
|
||||||
|
item.path = filePathToPOSIX(item.path)
|
||||||
const relpath = item.fullname.replace(relPathToReplace, '')
|
const relpath = item.fullname.replace(relPathToReplace, '')
|
||||||
let reldirname = Path.dirname(relpath)
|
let reldirname = Path.dirname(relpath)
|
||||||
if (reldirname === '.') reldirname = ''
|
if (reldirname === '.') reldirname = ''
|
||||||
|
Loading…
Reference in New Issue
Block a user