ltrim $display_path in attach_store() to be consistent with attach_mkdir() and go to created folder after successfully creating one

This commit is contained in:
git-marijus 2017-07-30 19:21:02 +02:00
parent ead80481b9
commit 4a071b9a1c
2 changed files with 4 additions and 2 deletions

View File

@ -35,6 +35,8 @@ class File_upload extends \Zotlabs\Web\Controller {
if($_REQUEST['filename']) { if($_REQUEST['filename']) {
$r = attach_mkdir($channel, get_observer_hash(), $_REQUEST); $r = attach_mkdir($channel, get_observer_hash(), $_REQUEST);
if($r['success'])
goaway(z_root() . '/cloud/' . $channel['channel_address'] . '/' . $r['data']['display_path']);
} }
else { else {
$r = attach_store($channel, get_observer_hash(), '', $_REQUEST); $r = attach_store($channel, get_observer_hash(), '', $_REQUEST);

View File

@ -708,7 +708,7 @@ function attach_store($channel, $observer_hash, $options = '', $arr = null) {
$os_relpath = ltrim($os_relpath,'/'); $os_relpath = ltrim($os_relpath,'/');
$os_path = $os_relpath; $os_path = $os_relpath;
$display_path = $pathname . '/' . $filename; $display_path = ltrim($pathname . '/' . $filename,'/');
if($src) if($src)
@file_put_contents($os_basepath . $os_relpath,@file_get_contents($src)); @file_put_contents($os_basepath . $os_relpath,@file_get_contents($src));
@ -886,7 +886,7 @@ function attach_store($channel, $observer_hash, $options = '', $arr = null) {
} }
if($notify) { if($notify) {
$cloudPath = z_root() . '/cloud/' . $channel['channel_address'] . $r['0']['display_path']; $cloudPath = z_root() . '/cloud/' . $channel['channel_address'] . '/' . $r['0']['display_path'];
$object = get_file_activity_object($channel['channel_id'], $r['0']['hash'], $cloudPath); $object = get_file_activity_object($channel['channel_id'], $r['0']['hash'], $cloudPath);
file_activity($channel['channel_id'], $object, $r['0']['allow_cid'], $r['0']['allow_gid'], $r['0']['deny_cid'], $r['0']['deny_gid'], 'post', $notify); file_activity($channel['channel_id'], $object, $r['0']['allow_cid'], $r['0']['allow_gid'], $r['0']['deny_cid'], $r['0']['deny_gid'], 'post', $notify);
} }