aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2021-01-06 19:26:40 +0000
committerMario <mario@mariovavti.com>2021-01-06 20:34:49 +0100
commitdd0da70b06ae0baca91211815a94e8a6f32b46ff (patch)
tree3d2544c4445c4aca98e519c36ebf7cd3f8a5e411
parentd80f2a621d47b372328743437871101ab0fbaa1d (diff)
downloadvolse-hubzilla-dd0da70b06ae0baca91211815a94e8a6f32b46ff.tar.gz
volse-hubzilla-dd0da70b06ae0baca91211815a94e8a6f32b46ff.tar.bz2
volse-hubzilla-dd0da70b06ae0baca91211815a94e8a6f32b46ff.zip
filter out self and child folders from the folder list
(cherry picked from commit a0c8e1959af2a98400fd9fbbdc61471bbf461614)
-rw-r--r--Zotlabs/Storage/Browser.php13
1 files changed, 10 insertions, 3 deletions
diff --git a/Zotlabs/Storage/Browser.php b/Zotlabs/Storage/Browser.php
index f8377eb70..e447a41e8 100644
--- a/Zotlabs/Storage/Browser.php
+++ b/Zotlabs/Storage/Browser.php
@@ -100,7 +100,7 @@ class Browser extends DAV\Browser\Plugin {
$folder_parent = ((isset($arr[1])) ? prev($arr) : '');
$folder_list = attach_folder_select_list($channel_id);
-
+hz_syslog(print_r($folder_list,true));
$siteroot_disabled = get_config('system', 'cloud_disable_siteroot');
$is_root_folder = (($path === 'cloud/' . $nick) ? true : false);
@@ -294,9 +294,16 @@ class Browser extends DAV\Browser\Plugin {
// create a copy of the list which we can alter for the current resource
$folders = $folder_list;
+
if($data['is_dir']) {
- // can not copy a folder into itself
- unset($folders[$folder_hash]);
+
+ $rm_path = $folders[$folder_hash];
+ // can not copy a folder into itself or own child folders
+ foreach($folders as $k => $v) {
+ if(strpos($v, $rm_path) === 0)
+ unset($folders[$k]);
+ }
+
}
$ft['newfolder'] = ['newfolder_' . $id, t('Select a target location'), $data['folder'], '', $folders];