From d0331ca837f95c0cd7a3ed13e6042a876827cb07 Mon Sep 17 00:00:00 2001 From: Nathan Gray Date: Mon, 24 Nov 2014 19:47:48 +0000 Subject: [PATCH] Be more careful with checking for target path, could be user selected a directory not a file --- filemanager/js/app.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/filemanager/js/app.js b/filemanager/js/app.js index 23e08539a0..a20cee04a0 100644 --- a/filemanager/js/app.js +++ b/filemanager/js/app.js @@ -449,7 +449,16 @@ app.classes.filemanager = AppJS.extend( if(action) { var paths = this._elems2paths(selected); - if(paths[0]) path = this.dirname(paths[0]); + if(paths[0]) path = paths[0]; + // check if target is a file --> use it's directory instead + if(selected[0].id || path) + { + var data = egw.dataGetUIDdata(selected[0].id || 'filemanager::'+path ); + if (data && data.data.mime != 'httpd/unix-directory') + { + path = this.dirname(path); + } + } } this._do_action('createdir', dir, true, path); // true=synchronous request this.change_dir((path == '/' ? '' : path)+'/'+dir);