mirror of
https://github.com/logseq/logseq.git
synced 2026-05-03 10:26:35 +00:00
improve: add safe path join
This commit is contained in:
@@ -310,5 +310,18 @@ export const nodePath = Object.assign({}, path, {
|
||||
extname (input) {
|
||||
input = toPosixPath(input)
|
||||
return path.extname(input)
|
||||
},
|
||||
|
||||
join (input, ...paths) {
|
||||
let orURI = null
|
||||
|
||||
try {
|
||||
orURI = new URL(input)
|
||||
input = orURI.pathname
|
||||
} catch (_e) {}
|
||||
|
||||
input = path.join(input, ...paths)
|
||||
|
||||
return (orURI ? (orURI.protocol + '//') : '') + input
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user