Fix "Edit on eXeLearning and return to course" button. - #73
Merged
eXeLearningProject merged 2 commits intoAug 26, 2026
Merged
Conversation
erseco
approved these changes
Aug 25, 2026
erseco
left a comment
Collaborator
There was a problem hiding this comment.
The redirect flow and the additional tests look good to me. One minor suggestion: get_returnto_url() currently reimplements Moodle's local URL detection, and its HTTPS fallback is not exactly equivalent to moodle_url::out_as_local_url().
We could avoid exception-based control flow while still relying on Moodle's own semantics by checking $returnto->is_local_url() first and then calling out_as_local_url(false).
Not blocking from my side, since the current implementation only carries the local path and does not introduce an open redirect.
Collaborator
Author
|
Thanks for reviewing this. |
eXeLearningProject
deleted the
2321-fix-editonlineandreturntocourse-button
branch
August 26, 2026 06:44
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes the
Could not build platform integration URL from return URLerror raised by eXeLearningwhen sending the package back (Finish / File → Send to Moodle).
Same fix as
mod_exescorm.Cause
eXeLearning derives its Moodle callback endpoints (
get_ode.php/set_ode.php) by splitting theJWT
returnurlon a known path, and only accepts/mod/exeweb,/mod/exescormor/course/section. The "return to course" button sends/course/view.php?id=N, which matches noneof them on Moodle 4.5.
Fix
Return targets outside the module are now wrapped in a new
returnto.php, which lives under themodule path — so eXeLearning accepts it — and forwards the browser to the real destination.
returnto.php(new): web entry point; validates the destination withPARAM_LOCALURLandredirects. Falls back to the activity's course.
classes/exeonline/exeonline_redirector.php: wraps non-module return URLs (get_returnto_url())and resolves them back (
resolve_returnto_url()).tests/exeonline/exeonline_redirector_test.php(new): 5 unit tests.No database, language string or JavaScript changes.
Notes
/course/viewinbuildIntegrationUrl(), but this fix worksagainst already deployed instances.
Testing
Edit an eXeLearning Web activity → Edit on eXeLearning and return to course → Finish.
The package is saved and the browser lands on the course page.
Moodle Playground Preview
The changes in this pull request can be previewed and tested using a Moodle Playground instance.
ℹ️ The eXeLearning editor is fetched from the shared release and unpacked into the plugin when the playground boots, so the first load may take a few extra seconds. ELPX upload, viewer and preview work normally.