util/dcp (server to cloud file copy) better handling when destination directory is the channel root
This commit is contained in:
parent
739a612824
commit
549f7a53b1
14
util/dcp
14
util/dcp
@ -28,9 +28,14 @@ if($argc < 3) {
|
||||
if(strpos($dstfile,'store/') === 0)
|
||||
$dstfile = substr($dstfile,6);
|
||||
|
||||
if(strpos($dstfile,'/'))
|
||||
$nick = substr($dstfile,0,strpos($dstfile,'/'));
|
||||
|
||||
$dstfile = substr($dstfile,strlen($nick)+1);
|
||||
}
|
||||
else {
|
||||
$nick = $dstfile;
|
||||
$dstfile = '';
|
||||
}
|
||||
|
||||
$channel = channelx_by_nick($nick);
|
||||
if(! $channel)
|
||||
@ -43,6 +48,7 @@ if($argc < 3) {
|
||||
}
|
||||
}
|
||||
|
||||
$rootdir = ((strlen(trim($dstfile,'/'))) ? false : true);
|
||||
|
||||
$isadir = false;
|
||||
|
||||
@ -50,6 +56,11 @@ if($argc < 3) {
|
||||
$isadir = true;
|
||||
|
||||
|
||||
if($rootdir) {
|
||||
$folder = '';
|
||||
}
|
||||
else {
|
||||
|
||||
$r = q("select * from attach where display_path = '%s' and uid = %d limit 1",
|
||||
dbesc($dstfile),
|
||||
intval($channel['channel_id'])
|
||||
@ -77,6 +88,7 @@ if($argc < 3) {
|
||||
$folder = $x['data']['hash'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for($x = 1; $x < ($argc - 1); $x ++) {
|
||||
if(($argv[$x] === '-r') || ($argv[$x] === '-R')) {
|
||||
|
Reference in New Issue
Block a user