Skip to content

Unsupported redirect detected, script execution terminated #710

@brendanheywood

Description

@brendanheywood

Some plugins have implemented their own file serving, which breaks when its an ajax script.

presigned_url_should_redirect_file should return false if it detects AJAX_SCRIPT because core checks this:

lib/weblib.php-2078-function redirect($url, $message='', $delay=null, $messagetype = \core\output\notification::NOTIFY_INFO): Never {
lib/weblib.php-2079-    global $OUTPUT, $PAGE, $CFG;
lib/weblib.php-2080-
lib/weblib.php-2081-    if (CLI_SCRIPT or AJAX_SCRIPT) {
lib/weblib.php-2082-        // This is wrong - developers should not use redirect in these scripts but it should not be very likely.
lib/weblib.php:2083:        throw new moodle_exception('redirecterrordetected', 'error');
lib/weblib.php-2084-    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions