Moodle

Hyperlinking directly to a course from outside, e.g. a word document or forum email message

Details

  • Type: Bug Bug
  • Status: Reopened Reopened
  • Priority: Minor Minor
  • Resolution: Unresolved
  • Affects Version/s: 1.8.1
  • Fix Version/s: None
  • Component/s: Unknown
  • Labels:
    None
  • Environment:
    Windows server 2003, Apache 2.0.52, php 5.2.0, MySQL 5.0.37

Description

If you distribute a hyperlink to a course in Moodle via a Word document for example and the user clicks on the link the log in page appears (if you are not already logged in) and then it takes you to the home page of Moodle. It does not take you directly to the course as it did in prior versions of Moodle.
There is a forum posting on Moodle.org
http://moodle.org/mod/forum/discuss.php?d=77693#p354197

Also forum digest messages that include hyperlinks back to the annoucements are currently bringing up a 404 page not found error. I'm assuming that this is the same issue as it is a hyperlink outside of Moodle but it may well be slightly different as it produces a slightly different result.

Activity

Hide
Dan Poltawski added a comment -

Hi, I see from your forum thread that the issue seems to have gone away, so I am closing this.

Show
Dan Poltawski added a comment - Hi, I see from your forum thread that the issue seems to have gone away, so I am closing this.
Hide
Mark Aberdour added a comment -

Hi Dan,
This bug is still very much "in the wild"!
Pls see forum thread at http://moodle.org/mod/forum/post.php?reply=486951

In my case the bug is reproducible from Word 2007 (saved as DOC, DOCX or RTF).
However if saved as a PDF or as a web page from Word, then the link works fine.

Show
Mark Aberdour added a comment - Hi Dan, This bug is still very much "in the wild"! Pls see forum thread at http://moodle.org/mod/forum/post.php?reply=486951 In my case the bug is reproducible from Word 2007 (saved as DOC, DOCX or RTF). However if saved as a PDF or as a web page from Word, then the link works fine.
Hide
Matt Jenner added a comment -

This 'bug' is still present in 1.9.3, my build is from about two weeks ago.

Show
Matt Jenner added a comment - This 'bug' is still present in 1.9.3, my build is from about two weeks ago.
Hide
Mark Aberdour added a comment -

This bug should not be closed, it is still a problem.

Show
Mark Aberdour added a comment - This bug should not be closed, it is still a problem.
Hide
christian.theou added a comment -

This 'bug' is still present in 1.9.4+, my build is from yesterday.
This bug should not be closed, it is still a problem.

Show
christian.theou added a comment - This 'bug' is still present in 1.9.4+, my build is from yesterday. This bug should not be closed, it is still a problem.
Hide
Dan Poltawski added a comment -

Reopening to investigate

Show
Dan Poltawski added a comment - Reopening to investigate
Hide
Alex O'Neill added a comment -

Just to add, it seems to work fine from an identical PDF file with link - probably a specific Microsoft Word issue.

Show
Alex O'Neill added a comment - Just to add, it seems to work fine from an identical PDF file with link - probably a specific Microsoft Word issue.
Hide
christian.theou added a comment -

Yes , it works very fine with PDF and also OpenOffice suite but not with Microsoft Office. It is the problem !!

Show
christian.theou added a comment - Yes , it works very fine with PDF and also OpenOffice suite but not with Microsoft Office. It is the problem !!
Hide
Andrea Gordon added a comment -

Any progress on this? The issue still exists on latest build of version 1.9.7.

Show
Andrea Gordon added a comment - Any progress on this? The issue still exists on latest build of version 1.9.7.
Hide
Andrei Bautu added a comment -

I spent the last 2 days to solve this (I'm using 1.9.7+ from 20100310). The problem is caused by a the way Moodle handles redirects and the way Windows APIs handles requests for hyperlinked documents (aka HLINK). Details and solutions are at http://support.microsoft.com/kb/899927/en-us.

For short, this is what happens: when you click a hyperlink in an Office document (or other application that uses the Windows HLink API), the Windows API will try to retrieve the document first. If the document is in a private course, Moodle will reply with a redirect to the login page (because HLink doesn't have a valid cookie, even if you already logged in your browser). Because of the redirect, HLink API will ask your browser to open the new URL (i.e. the login page) instead of the original URL (i.e. the resource page).

To solve this problem you have to simple solutions (and some more complex ones):

  • solve it on the user computer: create a DWORD registry key in HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\9.0\Common\Internet called ForceShellExecute with value 1. Restart your Office application.
  • solve it on the server: open lib/weblib.php, find the definition of function redirect, and comment the two lines that start with @header.

Cheers,
Andrei

Show
Andrei Bautu added a comment - I spent the last 2 days to solve this (I'm using 1.9.7+ from 20100310). The problem is caused by a the way Moodle handles redirects and the way Windows APIs handles requests for hyperlinked documents (aka HLINK). Details and solutions are at http://support.microsoft.com/kb/899927/en-us. For short, this is what happens: when you click a hyperlink in an Office document (or other application that uses the Windows HLink API), the Windows API will try to retrieve the document first. If the document is in a private course, Moodle will reply with a redirect to the login page (because HLink doesn't have a valid cookie, even if you already logged in your browser). Because of the redirect, HLink API will ask your browser to open the new URL (i.e. the login page) instead of the original URL (i.e. the resource page). To solve this problem you have to simple solutions (and some more complex ones):
  • solve it on the user computer: create a DWORD registry key in HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\9.0\Common\Internet called ForceShellExecute with value 1. Restart your Office application.
  • solve it on the server: open lib/weblib.php, find the definition of function redirect, and comment the two lines that start with @header.
Cheers, Andrei
Hide
Michael Hughes added a comment -

this fix works but what (if any) are the security implications of enabling this fix in a production environment? I notice that this bug still exists with Moodle2 - just tested on our dev platform.

Show
Michael Hughes added a comment - this fix works but what (if any) are the security implications of enabling this fix in a production environment? I notice that this bug still exists with Moodle2 - just tested on our dev platform.
Hide
Steve Bond added a comment -

Can anyone comment on Andrei's proposed server-side solution? As Michael points out, I would not want to do this unless I were sure that it was not a security problem.

Another thread exists here: http://moodle.org/mod/forum/discuss.php?d=126578 where a different solution is proposed, but again the implications are not clear.

Show
Steve Bond added a comment - Can anyone comment on Andrei's proposed server-side solution? As Michael points out, I would not want to do this unless I were sure that it was not a security problem. Another thread exists here: http://moodle.org/mod/forum/discuss.php?d=126578 where a different solution is proposed, but again the implications are not clear.

Dates

  • Created:
    Updated: