forked from extern/egroupware
* Filemanager/WebDAV: handle url-special chars like %, # and ? correctly
This commit is contained in:
parent
d8d6d4d247
commit
4b5379d61b
@ -7,8 +7,7 @@
|
||||
* @link http://www.egroupware.org
|
||||
* @author Nathan Gray
|
||||
* @copyright Nathan Gray 2012
|
||||
* @version $Id$
|
||||
*/
|
||||
*/
|
||||
|
||||
/*egw:uses
|
||||
/vendor/bower-asset/jquery/dist/jquery.js;
|
||||
@ -321,13 +320,6 @@ var et2_vfsPath = (function(){ "use strict"; return et2_vfsName.extend(
|
||||
{
|
||||
_value = _value.path;
|
||||
}
|
||||
try
|
||||
{
|
||||
_value = egw.decodePath(_value);
|
||||
} catch (e)
|
||||
{
|
||||
_value = 'Error! ' + _value;
|
||||
}
|
||||
if(_value === this.options.value && this._oldValue !== et2_no_init) return;
|
||||
|
||||
var path_parts = _value.split('/');
|
||||
@ -391,7 +383,7 @@ var et2_vfsPath = (function(){ "use strict"; return et2_vfsName.extend(
|
||||
}
|
||||
},
|
||||
getValue: function() {
|
||||
return egw.encodePath(this.options.value);
|
||||
return this.options ? this.options.value : null;
|
||||
}
|
||||
});}).call(this);
|
||||
et2_register_widget(et2_vfsPath, ["vfs-path"]);
|
||||
@ -959,6 +951,9 @@ var et2_vfsUpload = (function(){ "use strict"; return et2_file.extend(
|
||||
|
||||
/**
|
||||
* A file upload is finished, update the UI
|
||||
*
|
||||
* @param {object} file
|
||||
* @param {string|object} response
|
||||
*/
|
||||
finishUpload: function(file, response) {
|
||||
var result = this._super.apply(this, arguments);
|
||||
@ -1113,7 +1108,7 @@ var et2_vfsSelect = (function(){ "use strict"; return et2_inputWidget.extend(
|
||||
name: "button icon",
|
||||
type: "string",
|
||||
default: "check",
|
||||
description: "Custom icon to show on submit button.",
|
||||
description: "Custom icon to show on submit button."
|
||||
},
|
||||
"name": {
|
||||
name:"File name",
|
||||
@ -1131,7 +1126,7 @@ var et2_vfsSelect = (function(){ "use strict"; return et2_inputWidget.extend(
|
||||
"extra_buttons": {
|
||||
name: "extra action buttons",
|
||||
type: "any",
|
||||
description: "Extra buttons passed to dialog. It's co-related to method.",
|
||||
description: "Extra buttons passed to dialog. It's co-related to method."
|
||||
}
|
||||
},
|
||||
|
||||
@ -1298,7 +1293,7 @@ var et2_vfsSelect = (function(){ "use strict"; return et2_inputWidget.extend(
|
||||
var et2 = {};
|
||||
if (etemplate && etemplate.name && !app[egw(window).app_name()])
|
||||
{
|
||||
et2 = etemplate2.getByTemplate(etemplate.name)[0]
|
||||
et2 = etemplate2.getByTemplate(etemplate.name)[0];
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1,14 +1,13 @@
|
||||
<?php
|
||||
/**
|
||||
* eGroupWare API: VFS - static methods to use the new eGW virtual file system
|
||||
* EGroupware API: VFS - static methods to use the new eGW virtual file system
|
||||
*
|
||||
* @link http://www.egroupware.org
|
||||
* @link https://www.egroupware.org
|
||||
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
|
||||
* @package api
|
||||
* @subpackage vfs
|
||||
* @author Ralf Becker <RalfBecker-AT-outdoor-training.de>
|
||||
* @copyright (c) 2008-16 by Ralf Becker <RalfBecker-AT-outdoor-training.de>
|
||||
* @version $Id$
|
||||
* @copyright (c) 2008-19 by Ralf Becker <RalfBecker-AT-outdoor-training.de>
|
||||
*/
|
||||
|
||||
namespace EGroupware\Api;
|
||||
@ -1618,7 +1617,7 @@ class Vfs
|
||||
$zip->setArchiveComment(lang('Created by %1', $GLOBALS['egw_info']['user']['account_lid']) . ' ' .DateTime::to());
|
||||
|
||||
// Record total for debug, not available after close()
|
||||
$total_files = $zip->numFiles;
|
||||
//$total_files = $zip->numFiles;
|
||||
|
||||
$result = $zip->close();
|
||||
if(!$result || !filesize($zip_file))
|
||||
@ -1863,7 +1862,7 @@ class Vfs
|
||||
* @var array
|
||||
*/
|
||||
static public $encode = array(
|
||||
//'%' => '%25', // % should be encoded, but easily leads to double encoding, therefore better NOT encodig it
|
||||
'%' => '%25',
|
||||
'#' => '%23',
|
||||
'?' => '%3F',
|
||||
'/' => '', // better remove it completly
|
||||
|
@ -185,9 +185,10 @@ class WebDAV extends HTTP_WebDAV_Server_Filesystem
|
||||
}
|
||||
|
||||
$dest = $this->base . $options["dest"];
|
||||
$destdir = dirname($dest);
|
||||
$destdir = Vfs::dirname($dest);
|
||||
|
||||
if (!file_exists($destdir) || !is_dir($destdir)) {
|
||||
//error_log(__METHOD__."(".array2string($options).", $del) file_exists('$destdir')=".array2string(file_exists($destdir)).", is_dir('$destdir')=".array2string(is_dir($destdir)));
|
||||
return "409 Conflict";
|
||||
}
|
||||
|
||||
|
@ -4,9 +4,8 @@
|
||||
* @link http://www.egroupware.org
|
||||
* @package filemanager
|
||||
* @author Ralf Becker <RalfBecker-AT-outdoor-training.de>
|
||||
* @copyright (c) 2008-14 by Ralf Becker <RalfBecker-AT-outdoor-training.de>
|
||||
* @copyright (c) 2008-19 by Ralf Becker <RalfBecker-AT-outdoor-training.de>
|
||||
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -246,7 +245,8 @@ app.classes.filemanager = AppJS.extend(
|
||||
{
|
||||
for(etemplate_name in this.path_widget) break;
|
||||
}
|
||||
return this.path_widget[etemplate_name] ? this.path_widget[etemplate_name].get_value() : null;
|
||||
var path_widget = this.path_widget[etemplate_name];
|
||||
return path_widget ? path_widget.get_value.apply(path_widget) : null;
|
||||
},
|
||||
|
||||
/**
|
||||
@ -317,10 +317,6 @@ app.classes.filemanager = AppJS.extend(
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Finish callback for file a file dialog, to get the overwrite / rename prompt
|
||||
*
|
||||
@ -378,8 +374,8 @@ app.classes.filemanager = AppJS.extend(
|
||||
if (_data.uploaded[file].confirm && !_data.uploaded[file].confirmed)
|
||||
{
|
||||
var buttons = [
|
||||
{text: this.egw.lang("Yes"), id: "overwrite", class: "ui-priority-primary", "default": true, image: 'check',},
|
||||
{text: this.egw.lang("Rename"), id:"rename", image: 'edit',},
|
||||
{text: this.egw.lang("Yes"), id: "overwrite", class: "ui-priority-primary", "default": true, image: 'check'},
|
||||
{text: this.egw.lang("Rename"), id:"rename", image: 'edit'},
|
||||
{text: this.egw.lang("Cancel"), id:"cancel"}
|
||||
];
|
||||
if (_data.uploaded[file].confirm === "is_dir")
|
||||
@ -587,7 +583,7 @@ app.classes.filemanager = AppJS.extend(
|
||||
}
|
||||
}
|
||||
self._do_action('createdir', egw.encodePathComponent(dir), true, path); // true=synchronous request
|
||||
self.change_dir((path == '/' ? '' : path)+'/'+ dir);
|
||||
self.change_dir((path == '/' ? '' : path)+'/'+ egw.encodePathComponent(dir));
|
||||
}
|
||||
},this.egw.lang('New directory'),this.egw.lang('Create directory'));
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user