* Filemanager/WebDAV: handle url-special chars like %, # and ? correctly

This commit is contained in:
Ralf Becker 2019-03-21 12:36:07 +01:00
parent 3c107a70f7
commit c9fa2c3645
4 changed files with 21 additions and 23 deletions

View File

@ -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;
@ -808,6 +807,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);
@ -962,7 +964,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",
@ -980,7 +982,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."
}
},
@ -1145,7 +1147,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
{

View File

@ -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;
@ -1616,7 +1615,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))
@ -1861,7 +1860,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

View File

@ -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";
}

View File

@ -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;
},
/**
@ -316,10 +316,6 @@ app.classes.filemanager = AppJS.extend(
}
},
/**
* Finish callback for file a file dialog, to get the overwrite / rename prompt
*
@ -377,8 +373,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")
@ -585,8 +581,8 @@ app.classes.filemanager = AppJS.extend(
}
}
}
self._do_action('createdir', dir, true, path); // true=synchronous request
self.change_dir((path == '/' ? '' : path)+'/'+ dir);
self._do_action('createdir', egw.encodePathComponent(dir), true, path); // true=synchronous request
self.change_dir((path == '/' ? '' : path)+'/'+ egw.encodePathComponent(dir));
}
},this.egw.lang('New directory'),this.egw.lang('Create directory'));
},