Details

    • Affected Branches:
      MOODLE_19_STABLE
    • Fixed Branches:
      MOODLE_20_STABLE

      Description

      Some users ignored this prefix text and typed in their own. This either caused validation errors or corrupted links.

      Why it matters

      It's generally best practice to avoid partially populating input controls. In this case,it isn't a necessary helper for any user, blind or sighted.

      Possible solution

      Code to detect a missing "http://" and prepend it to links is trivial.

        Gliffy Diagrams

        1. 20100305_MDL-20509_HEAD.patch
          2 kB
          Rossiani Wijaya
        2. 20100624_MDL-20509_2.0.patch
          2 kB
          Rossiani Wijaya

          Issue Links

            Activity

            Hide
            Rossiani Wijaya added a comment -

            The 'http://' prefix has been removed from the input box.

            During submission, the system will detect user input and determine the needs to add 'http://' to the url.

            Show
            Rossiani Wijaya added a comment - The 'http://' prefix has been removed from the input box. During submission, the system will detect user input and determine the needs to add 'http://' to the url.
            Hide
            Helen Foster added a comment -

            Hi Rosie,

            I've just checked the database of web links activity on our QA testing site http://qa.moodle.net/mod/data/edit.php?d=2 and found http:// in the URL field.

            Show
            Helen Foster added a comment - Hi Rosie, I've just checked the database of web links activity on our QA testing site http://qa.moodle.net/mod/data/edit.php?d=2 and found http:// in the URL field.
            Hide
            Rossiani Wijaya added a comment -

            Hi Helen,

            When creating a new url resource, the external link field is emtpy.

            The http:// occurs on http://qa.moodle.net/mod/data/edit.php?d=2 because when the url was created the url field was not populated. Therefore, during submission, the system did not found the the existence of 'http;//' prefix in the url and append the prefix automatically to the url string before saving it to the database. since the link was save in the database containing http:// only, the url field in edit page is automatically populated with http:// string.

            I modified the url_update_instance and url_add_instance functions to ignore adding the prefix when the field is empty.

            attaching patch.

            Show
            Rossiani Wijaya added a comment - Hi Helen, When creating a new url resource, the external link field is emtpy. The http:// occurs on http://qa.moodle.net/mod/data/edit.php?d=2 because when the url was created the url field was not populated. Therefore, during submission, the system did not found the the existence of 'http;//' prefix in the url and append the prefix automatically to the url string before saving it to the database. since the link was save in the database containing http:// only, the url field in edit page is automatically populated with http:// string. I modified the url_update_instance and url_add_instance functions to ignore adding the prefix when the field is empty. attaching patch.
            Hide
            Rossiani Wijaya added a comment -

            Helen,

            My above comments was referring to "add a resource" -> "URL", which also has a tiny bug with submitting an empty url field. Somehow i stumbled back to add resources url while testing your posted link. oops.

            Reviewing the "real" database of web links activity.

            Show
            Rossiani Wijaya added a comment - Helen, My above comments was referring to "add a resource" -> "URL", which also has a tiny bug with submitting an empty url field. Somehow i stumbled back to add resources url while testing your posted link. oops. Reviewing the "real" database of web links activity.
            Hide
            Rossiani Wijaya added a comment -

            fix for database of web links activity:

            • remove http:// prefix from input box
            • added some code to check for the existence of http://, if it's not exist, it will add 'http://' prefix to the url.

            The patch will fix database of web links activity page and add a resource" -> "URL" (from course page)

            adding Sam to review the patch

            Show
            Rossiani Wijaya added a comment - fix for database of web links activity: remove http:// prefix from input box added some code to check for the existence of http:// , if it's not exist, it will add 'http://' prefix to the url. The patch will fix database of web links activity page and add a resource" -> "URL" (from course page) adding Sam to review the patch
            Hide
            Rossiani Wijaya added a comment -

            accessibility qa site is located at http://access.moodle.net/mod/data/field.php?d=1

            Show
            Rossiani Wijaya added a comment - accessibility qa site is located at http://access.moodle.net/mod/data/field.php?d=1
            Hide
            Sam Hemelryk added a comment -

            Hi Rossi

            I've had a look at the patch you have posted, removing the default http:// is fine however there is a problem if the user enter a relative URL.
            If we do want to add http:// we need to ensure that we are adding it only when required, either that or we ONLY allow fully qualified links.
            Have a think about it and see what you can come up with.

            Cheers
            Sam

            Show
            Sam Hemelryk added a comment - Hi Rossi I've had a look at the patch you have posted, removing the default http:// is fine however there is a problem if the user enter a relative URL. If we do want to add http:// we need to ensure that we are adding it only when required, either that or we ONLY allow fully qualified links. Have a think about it and see what you can come up with. Cheers Sam
            Hide
            Martin Dougiamas added a comment -

            If it's /something then we need to leave it, and also if it's nntp:// or ftp://

            So just add http:// when

            • there is no :// in the string already, and
            • the string doesn't start with /
            Show
            Martin Dougiamas added a comment - If it's /something then we need to leave it, and also if it's nntp:// or ftp:// So just add http:// when there is no :// in the string already, and the string doesn't start with /
            Hide
            Rossiani Wijaya added a comment -

            update patch according to Martin's suggestion.

            Show
            Rossiani Wijaya added a comment - update patch according to Martin's suggestion.
            Hide
            Rossiani Wijaya added a comment -

            commit patch to 2.0

            Show
            Rossiani Wijaya added a comment - commit patch to 2.0

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: