fix path naming
This commit is contained in:
parent
3699fbb549
commit
605af978dc
@ -8,7 +8,7 @@ const isPortReachable = require('./isPortReachable')
|
|||||||
const EventEmitter = require('events');
|
const EventEmitter = require('events');
|
||||||
const _ = require('lodash')
|
const _ = require('lodash')
|
||||||
const fs = require('fs')
|
const fs = require('fs')
|
||||||
const path = require('path')
|
const ph = require('path')
|
||||||
|
|
||||||
class p2p {
|
class p2p {
|
||||||
constructor(send = () => {})
|
constructor(send = () => {})
|
||||||
@ -140,7 +140,7 @@ class p2p {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
const filePath = path.resolve(this.dataDirectory + '/' + path)
|
const filePath = ph.resolve(this.dataDirectory + '/' + path)
|
||||||
if(!filePath.includes(this.dataDirectory))
|
if(!filePath.includes(this.dataDirectory))
|
||||||
{
|
{
|
||||||
logTE('transfer', 'file get must be from data dir')
|
logTE('transfer', 'file get must be from data dir')
|
||||||
@ -411,7 +411,7 @@ class p2p {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
const fileStream = fs.createWriteStream(this.dataDirectory + '/' + (targetPath || path.basename(path)))
|
const fileStream = fs.createWriteStream(this.dataDirectory + '/' + (targetPath || ph.basename(path)))
|
||||||
let peer = null
|
let peer = null
|
||||||
let deleteCallback = (remotePeer || this).emit('file', {path}, (chunk, nil, addr) => {
|
let deleteCallback = (remotePeer || this).emit('file', {path}, (chunk, nil, addr) => {
|
||||||
if(peer && addr !== peer)
|
if(peer && addr !== peer)
|
||||||
|
Loading…
Reference in New Issue
Block a user