From 890cd4e4a498aacda7a55cbcc6f2a307e2221419 Mon Sep 17 00:00:00 2001 From: nathangray Date: Wed, 31 Jul 2019 09:46:55 -0600 Subject: [PATCH] Api - give error if share path is missing --- api/js/jsapi/app_base.js | 4 ++++ api/src/Sharing.php | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/api/js/jsapi/app_base.js b/api/js/jsapi/app_base.js index 0a30725d3a..37a701e6ec 100644 --- a/api/js/jsapi/app_base.js +++ b/api/js/jsapi/app_base.js @@ -1902,6 +1902,10 @@ var AppJS = (function(){ "use strict"; return Class.extend( */ share_link: function(_action, _senders, _target, _writable, _files, _callback){ var path = _senders[0].id; + if(!path) + { + return this.egw.message(this.egw.lang('Missing share path. Unable to create share.'), 'error'); + } if(typeof _writable === 'undefined' && _action.parent && _action.parent.getActionById('shareWritable')) { _writable = _action.parent.getActionById('shareWritable').checked || false; diff --git a/api/src/Sharing.php b/api/src/Sharing.php index dc3024c7ba..0729f2bf67 100644 --- a/api/src/Sharing.php +++ b/api/src/Sharing.php @@ -611,6 +611,10 @@ class Sharing */ public static function ajax_create($action, $path, $writable = false, $files = false, $extra = array()) { + if(!$path) + { + throw new Exception\WrongParameter('Missing share path. Unable to create share.'); + } $class = self::get_share_class(array('share_path' => $path)); $extra = $extra + array( 'share_writable' => $writable,