Skip to content

Commit

Permalink
Ignore posted message that are not intended for ElFinder
Browse files Browse the repository at this point in the history
  • Loading branch information
awa-xima committed Dec 15, 2024
1 parent 7544918 commit 370cc18
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
14 changes: 12 additions & 2 deletions js/elFinder.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion php/elFinder.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down

0 comments on commit 370cc18

Please sign in to comment.