From 5a54397c462afb7b8ace214576d4dcbc54c11022 Mon Sep 17 00:00:00 2001 From: nathangray Date: Wed, 9 Jun 2021 15:23:25 -0600 Subject: [PATCH] Importexport: Improve handling of targets - Give error if target uses an unknown stream wrapper - If stream wrapper is not provided, assume VFS (cherry picked from commit 93e2633107f701e12f07b9447612f4bc0613fe72) --- .../inc/class.importexport_schedule_ui.inc.php | 15 ++++++++++++--- importexport/lang/egw_en.lang | 1 + 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/importexport/inc/class.importexport_schedule_ui.inc.php b/importexport/inc/class.importexport_schedule_ui.inc.php index 0d54467221..f89f00a844 100644 --- a/importexport/inc/class.importexport_schedule_ui.inc.php +++ b/importexport/inc/class.importexport_schedule_ui.inc.php @@ -286,16 +286,25 @@ class importexport_schedule_ui * * $data should contain target & type */ - public static function check_target(Array $data) { + public static function check_target(Array &$data) { $scheme = parse_url($data['target'], PHP_URL_SCHEME); - if($scheme == '' || $scheme == 'file') + if($scheme == 'file') { return 'Direct file access not allowed'; } + else if ($scheme == '') + { + $data['target'] = Vfs::PREFIX.$data['target']; + return static::check_target($data); + } if($scheme == Vfs::SCHEME && !in_array(Vfs::SCHEME, stream_get_wrappers())) { stream_wrapper_register(Vfs::SCHEME, 'vfs_stream_wrapper', STREAM_IS_URL); } + else if (!in_array($scheme, stream_get_wrappers())) + { + return lang("Unable to access files with '%1'",$scheme); + } if ($data['type'] == 'import' && ($scheme == Vfs::SCHEME && !Vfs::is_readable($data['target']))) { @@ -398,7 +407,7 @@ class importexport_schedule_ui $data['last_run'] = time(); // Lock job for an hour to prevent multiples overlapping - $data['lock'] = time() + 3600; + // $data['lock'] = time() + 3600; self::update_job($data, true); // check file diff --git a/importexport/lang/egw_en.lang b/importexport/lang/egw_en.lang index 022cf94df3..65a05364d4 100644 --- a/importexport/lang/egw_en.lang +++ b/importexport/lang/egw_en.lang @@ -137,6 +137,7 @@ too many matches importexport en too many matches translation importexport en custom modifocation true importexport en True try importexport en Try +unable to access files with '%1' importexport en Unable to access files with '%1' unable to delete importexport en Unable to delete unable to link to %1 "%2" importexport en Unable to link to %1 "%2" unable to schedule importexport en Unable to schedule.