diff options
| author | Jan-Hendrik Willms <tleilax+studip@gmail.com> | 2022-05-03 12:09:37 +0000 |
|---|---|---|
| committer | Jan-Hendrik Willms <tleilax+studip@gmail.com> | 2022-05-03 12:09:37 +0000 |
| commit | 79c112f6aea337853209116a1fbd42c534b34370 (patch) | |
| tree | 35df4cc3b14c2b0faf427aa56923e0f04f84e350 /resources/assets/javascripts/lib/extract_callback.js | |
| parent | 33d059072ac4645572b20ca4f66d72fed15dba0c (diff) | |
fix js errors, fixes #968
Closes #968
Merge request studip/studip!558
Diffstat (limited to 'resources/assets/javascripts/lib/extract_callback.js')
| -rw-r--r-- | resources/assets/javascripts/lib/extract_callback.js | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/resources/assets/javascripts/lib/extract_callback.js b/resources/assets/javascripts/lib/extract_callback.js index 5b88607..4924646 100644 --- a/resources/assets/javascripts/lib/extract_callback.js +++ b/resources/assets/javascripts/lib/extract_callback.js @@ -8,7 +8,9 @@ export default function extractCallback(cmd, payload) { // Try to decode URI component in case it is encoded try { command = window.decodeURIComponent(command); - } catch (ignore) {} + } catch (ignore) { + // No action necessary + } // Try to parse value as JSON (value might be {func: 'foo', payload: {}}) try { @@ -18,12 +20,12 @@ export default function extractCallback(cmd, payload) { } // Check for invalid call - if (!command.hasOwnProperty('func')) { + if (command.func === undefined) { throw 'Dialog: Invalid value for X-Dialog-Execute'; } // Populate payload if not set - if (!command.hasOwnProperty('payload')) { + if (command.payload === undefined) { command.payload = payload; } @@ -37,7 +39,7 @@ export default function extractCallback(cmd, payload) { } // Check for not finished/closed chunk - if (chunk.match(/\([^\)]*$/)) { + if (chunk.match(/\([^)]*$/)) { last_chunk = chunk; return; } |
