Skip to content

Fix "Edit on eXeLearning and return to course" button. - #73

Merged
eXeLearningProject merged 2 commits into
mainfrom
2321-fix-editonlineandreturntocourse-button
Aug 26, 2026
Merged

eXeLearningProject merged 2 commits into
mainfrom
2321-fix-editonlineandreturntocourse-button

Conversation

@ignaciogros

@ignaciogros ignaciogros commented Aug 25, 2026

Copy link
Copy Markdown
Collaborator

Fixes the Could not build platform integration URL from return URL error raised by eXeLearning
when 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 the
JWT returnurl on a known path, and only accepts /mod/exeweb, /mod/exescorm or
/course/section. The "return to course" button sends /course/view.php?id=N, which matches none
of them on Moodle 4.5.

Fix

Return targets outside the module are now wrapped in a new returnto.php, which lives under the
module path — so eXeLearning accepts it — and forwards the browser to the real destination.

  • returnto.php (new): web entry point; validates the destination with PARAM_LOCALURL and
    redirects. 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

  • eXeLearning could also accept /course/view in buildIntegrationUrl(), but this fix works
    against already deployed instances.

Testing

Edit an eXeLearning Web activity → Edit on eXeLearning and return to courseFinish.
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.

Preview in Moodle Playground

ℹ️ 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.

@ignaciogros
ignaciogros requested a review from erseco August 25, 2026 10:29

@erseco erseco left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@ignaciogros

Copy link
Copy Markdown
Collaborator Author

Thanks for reviewing this.

@eXeLearningProject
eXeLearningProject merged commit 3b691f6 into main Aug 26, 2026
1 check passed
@eXeLearningProject
eXeLearningProject deleted the 2321-fix-editonlineandreturntocourse-button branch August 26, 2026 06:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants