aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgit-marijus <mario@mariovavti.com>2017-07-30 19:21:02 +0200
committergit-marijus <mario@mariovavti.com>2017-07-30 19:21:02 +0200
commit4a071b9a1cac32ed331a9a4e76d8a6c9aa312bef (patch)
treec2b2b9dcbfdfcbf4ab01c71f9b9eb574183dd399
parentead80481b967d529956694c7d8125e92fccee8c1 (diff)
downloadvolse-hubzilla-4a071b9a1cac32ed331a9a4e76d8a6c9aa312bef.tar.gz
volse-hubzilla-4a071b9a1cac32ed331a9a4e76d8a6c9aa312bef.tar.bz2
volse-hubzilla-4a071b9a1cac32ed331a9a4e76d8a6c9aa312bef.zip
ltrim $display_path in attach_store() to be consistent with attach_mkdir() and go to created folder after successfully creating one
-rw-r--r--Zotlabs/Module/File_upload.php2
-rw-r--r--include/attach.php4
2 files changed, 4 insertions, 2 deletions
diff --git a/Zotlabs/Module/File_upload.php b/Zotlabs/Module/File_upload.php
index f036d3f43..bce81ad7a 100644
--- a/Zotlabs/Module/File_upload.php
+++ b/Zotlabs/Module/File_upload.php
@@ -35,6 +35,8 @@ class File_upload extends \Zotlabs\Web\Controller {
if($_REQUEST['filename']) {
$r = attach_mkdir($channel, get_observer_hash(), $_REQUEST);
+ if($r['success'])
+ goaway(z_root() . '/cloud/' . $channel['channel_address'] . '/' . $r['data']['display_path']);
}
else {
$r = attach_store($channel, get_observer_hash(), '', $_REQUEST);
diff --git a/include/attach.php b/include/attach.php
index 4d20f094c..8de4983fa 100644
--- a/include/attach.php
+++ b/include/attach.php
@@ -708,7 +708,7 @@ function attach_store($channel, $observer_hash, $options = '', $arr = null) {
$os_relpath = ltrim($os_relpath,'/');
$os_path = $os_relpath;
- $display_path = $pathname . '/' . $filename;
+ $display_path = ltrim($pathname . '/' . $filename,'/');
if($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) {
- $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);
file_activity($channel['channel_id'], $object, $r['0']['allow_cid'], $r['0']['allow_gid'], $r['0']['deny_cid'], $r['0']['deny_gid'], 'post', $notify);
}