remote-root: normalize path before checking if path is in remote-root (avoid win32 error ?)
This commit is contained in:
parent
8f3513318f
commit
e8fdd22385
1 changed files with 2 additions and 2 deletions
|
|
@ -191,7 +191,7 @@ module.exports = {
|
|||
data.path = resolveHomeDir(data.path)
|
||||
|
||||
var root = resolveHomeDir(settings.read('remote-root'))
|
||||
if (root && !data.path.includes(root)) {
|
||||
if (root && !path.normalize(data.path).includes(path.normalize(root))) {
|
||||
console.error('(ERROR) Could not save: path outside of remote-root')
|
||||
return ipc.send('notify', {
|
||||
class: 'error',
|
||||
|
|
@ -430,7 +430,7 @@ module.exports = {
|
|||
var p = path.resolve(...data.path),
|
||||
root = resolveHomeDir(settings.read('remote-root'))
|
||||
|
||||
if (root && !p.includes(root)) p = root
|
||||
if (root && !path.normalize(p).includes(path.normalize(root))) p = root
|
||||
|
||||
fs.readdir(p, (err, files)=>{
|
||||
if (err) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue