diff --git a/js/elFinder.js b/js/elFinder.js index 20707b844..a607a8ea9 100644 --- a/js/elFinder.js +++ b/js/elFinder.js @@ -4838,8 +4838,18 @@ var elFinder = function(elm, opts, bootCallback) { obj, data; if (res && (self.convAbsUrl(self.options.url).indexOf(res.origin) === 0 || self.convAbsUrl(self.uploadURL).indexOf(res.origin) === 0)) { try { - obj = JSON.parse(res.data); - data = obj.data || null; + try { + if (typeof res.data !== 'string') { + return; + } + obj = JSON.parse(res.data); + if (obj.type !== "io.studio-42.github") { + return; + } + data = obj.data || null; + } catch (e2) { + return; + } if (data) { if (data.error) { if (obj.bind) { diff --git a/php/elFinder.class.php b/php/elFinder.class.php index 4dbfcf1af..3956c47a6 100644 --- a/php/elFinder.class.php +++ b/php/elFinder.class.php @@ -4183,7 +4183,7 @@ protected function callback($args) } } catch(e) { // for CORS - w.postMessage && w.postMessage(JSON.stringify({bind:\'' . $bind . '\',data:' . $json . '}), \'' . $origin . '\'); + w.postMessage && w.postMessage(JSON.stringify({type:\'io.studio-42.github\',bind:\'' . $bind . '\',data:' . $json . '}), \'' . $origin . '\'); } close(); setTimeout(function() {