Skip to content

Commit

Permalink
MDL-43679 core: Never use HTTP redirect when the user agent is MS Word
Browse files Browse the repository at this point in the history
  • Loading branch information
Frederic Massart committed Jan 2, 2015
1 parent 55f193d commit 0bbddb0
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions lib/weblib.php
Original file line number Diff line number Diff line change
Expand Up @@ -2510,6 +2510,16 @@ function redirect($url, $message='', $delay=-1) {
break;
}

if (core_useragent::is_msword()) {
// Clicking a URL from MS Word sends a request to the server without cookies. If that
// causes a redirect Word will open a browser pointing the new URL. If not, the URL that
// was clicked is opened. Because the request from Word is without cookies, it almost
// always results in a redirect to the login page, even if the user is logged in in their
// browser. This is not what we want, so prevent the redirect for requests from Word.
$debugdisableredirect = true;
break;
}

if (empty($CFG->debugdisplay) or empty($CFG->debug)) {
// No errors should be displayed.
break;
Expand Down

0 comments on commit 0bbddb0

Please sign in to comment.