Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-40162

Badge Not Displayed - Broken Link

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.5
    • Fix Version/s: 2.5.2
    • Component/s: Badges
    • Labels:
    • Testing Instructions:
      Hide

      To test:

      1. In Administration > Server > HTTP set "Use slash arguments" to "No" and check that badge image is uploaded successfully and is displayed.

      2. Go back to site Administration > Server > HTTP and set "Use slash arguments" to "Yes". Make sure that you can still upload a badge image and it is displayed on the page.

      Show
      To test: 1. In Administration > Server > HTTP set "Use slash arguments" to "No" and check that badge image is uploaded successfully and is displayed. 2. Go back to site Administration > Server > HTTP and set "Use slash arguments" to "Yes". Make sure that you can still upload a badge image and it is displayed on the page.
    • Affected Branches:
      MOODLE_25_STABLE
    • Fixed Branches:
      MOODLE_25_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-40162_master

      Description

      I've created a badge and uploaded the image (either via the web form, or by using FTP to upload the badge image to a file system repository). When creating or updating badge details, the filename appears in the upload box, however upon hitting submit the page returns with a broken image link (Which is hyperlinked to http://coursework.jonwestfall.com/pluginfile.php?file=%2F1484%2Fbadges%2Fbadgeimage%2F2%2Ff2?760). The broken image is visible in the screenshots.

      https://dl.dropboxusercontent.com/u/1779473/Screen%20Shot%202013-06-12%20at%2010.48.44%20AM.png
      https://dl.dropboxusercontent.com/u/1779473/Screen%20Shot%202013-06-12%20at%2010.48.58%20AM.png

      Slash arguments are off, as they do not work in my environment.

        Gliffy Diagrams

        1. image.patch
          1.0 kB
          Yuliya Bozhko
        1. quiztopgrade.png
          24 kB
        2. Screen Shot 2013-07-14 at 6.47.31 AM.png
          16 kB

          Activity

          Hide
          ybozhko Yuliya Bozhko added a comment -

          Hi Jon,

          Can you reproduce the issue with other images? I noticed that some images are not being processed because of some weird format...

          Yuliya

          Show
          ybozhko Yuliya Bozhko added a comment - Hi Jon, Can you reproduce the issue with other images? I noticed that some images are not being processed because of some weird format... Yuliya
          Hide
          jonwestfall Jon Westfall added a comment -

          Other images work fine, in fact the same images work fine if I put them elsewhere (i.e. in a label on my course's homepage). The images are PNG and JPG, the PNGs taken with Mac OS's built-in screen shot clipper. So it looks like this is related to badges, not images in general.

          Show
          jonwestfall Jon Westfall added a comment - Other images work fine, in fact the same images work fine if I put them elsewhere (i.e. in a label on my course's homepage). The images are PNG and JPG, the PNGs taken with Mac OS's built-in screen shot clipper. So it looks like this is related to badges, not images in general.
          Hide
          ybozhko Yuliya Bozhko added a comment -

          One more thing to try please Can you temporarily upload this image as a user profile picture? Badges use same image processing functionality as user profile pictures. It will help me to rule out the issue with that feature.

          Show
          ybozhko Yuliya Bozhko added a comment - One more thing to try please Can you temporarily upload this image as a user profile picture? Badges use same image processing functionality as user profile pictures. It will help me to rule out the issue with that feature.
          Hide
          jonwestfall Jon Westfall added a comment -

          Sure, it works fine as my profile picture. I didn't re-upload it (it was listed under "Recent files" in the file picker) but it displays fine as my user pic.

          Show
          jonwestfall Jon Westfall added a comment - Sure, it works fine as my profile picture. I didn't re-upload it (it was listed under "Recent files" in the file picker) but it displays fine as my user pic.
          Hide
          ybozhko Yuliya Bozhko added a comment -

          Can you please also attach this image here? Thanks!

          Show
          ybozhko Yuliya Bozhko added a comment - Can you please also attach this image here? Thanks!
          Hide
          jonwestfall Jon Westfall added a comment -

          Image that won't work. Made with Credly's badge designer, and then clipped using Mac OS X's screen shot capability (i.e. command+shift+4).

          Show
          jonwestfall Jon Westfall added a comment - Image that won't work. Made with Credly's badge designer, and then clipped using Mac OS X's screen shot capability (i.e. command+shift+4).
          Hide
          ybozhko Yuliya Bozhko added a comment -

          Hi Jon, I can't replicate the problem with your image... It is being displayed properly on my Moodle 2.5 install... I am not sure what to do with this issue. I will have a look a bit more, and will let you know.

          Show
          ybozhko Yuliya Bozhko added a comment - Hi Jon, I can't replicate the problem with your image... It is being displayed properly on my Moodle 2.5 install... I am not sure what to do with this issue. I will have a look a bit more, and will let you know.
          Hide
          emmarichardson Emma Richardson added a comment -

          I am having the same issue - cannot load an image to badges. I am using Moodle 2.5.1 (Build: 20130708). Image shows as a broken link.

          Show
          emmarichardson Emma Richardson added a comment - I am having the same issue - cannot load an image to badges. I am using Moodle 2.5.1 (Build: 20130708). Image shows as a broken link.
          Hide
          emmarichardson Emma Richardson added a comment -

          I just noticed that you said slash arguments are turned off as they are in my environment. The image appeared as soon as I turned this on but it seems I had to keep this turned off for my Rocket theme to work correctly. So this bug is related to slash arguments setting.

          Show
          emmarichardson Emma Richardson added a comment - I just noticed that you said slash arguments are turned off as they are in my environment. The image appeared as soon as I turned this on but it seems I had to keep this turned off for my Rocket theme to work correctly. So this bug is related to slash arguments setting.
          Hide
          jonwestfall Jon Westfall added a comment -

          I recently moved my site to a new server where I can use slash arguments. As soon as I enabled them, badges started appearing. So yes, it does appear to be something related to slash arguments being off.

          Show
          jonwestfall Jon Westfall added a comment - I recently moved my site to a new server where I can use slash arguments. As soon as I enabled them, badges started appearing. So yes, it does appear to be something related to slash arguments being off.
          Hide
          emmarichardson Emma Richardson added a comment -

          My site seems to be functioning with the setting enabled now so maybe I am ok too - I have recently upgraded my server. However, I think that this is still a bug that needs addressed for those that cannot enable this setting.

          Show
          emmarichardson Emma Richardson added a comment - My site seems to be functioning with the setting enabled now so maybe I am ok too - I have recently upgraded my server. However, I think that this is still a bug that needs addressed for those that cannot enable this setting.
          Hide
          simoncoggins Simon Coggins added a comment - - edited

          Yes, turning off slash arguments seems to reliably reproduce the bug.

          The problem is that the image URL is using a query string. With slash arguments on the URL is okay:

          /pluginfile.php/1/badges/badgeimage/1/f2?5466

          but with slash arguments off the url becomes:

          /pluginfile.php?file=/1/badges/badgeimage/1/f1?6351

          (note the two question marks) which isn't valid.

          The parameter is added in print_badge_image() in lib/badgeslib.php. According to the comments it is a random number to force the browser to reload the image. Looks like we need to come up with a better way to do that.

          Simon

          Show
          simoncoggins Simon Coggins added a comment - - edited Yes, turning off slash arguments seems to reliably reproduce the bug. The problem is that the image URL is using a query string. With slash arguments on the URL is okay: /pluginfile.php/1/badges/badgeimage/1/f2?5466 but with slash arguments off the url becomes: /pluginfile.php?file=/1/badges/badgeimage/1/f1?6351 (note the two question marks) which isn't valid. The parameter is added in print_badge_image() in lib/badgeslib.php. According to the comments it is a random number to force the browser to reload the image. Looks like we need to come up with a better way to do that. Simon
          Hide
          ybozhko Yuliya Bozhko added a comment - - edited

          I have attached a patch file for this issue if someone could test it on broken web site.

          Show
          ybozhko Yuliya Bozhko added a comment - - edited I have attached a patch file for this issue if someone could test it on broken web site.
          Hide
          poltawski Dan Poltawski added a comment -

          Hi Yuliya,

          The patch looks correct to me - thanks.

          Please could you create git branches for it and add a bit more detail to the testing instructions?

          It should be fairly easy to test this problem simply by disabling the slasharguments setting.

          thanks
          Dan

          Show
          poltawski Dan Poltawski added a comment - Hi Yuliya, The patch looks correct to me - thanks. Please could you create git branches for it and add a bit more detail to the testing instructions? It should be fairly easy to test this problem simply by disabling the slasharguments setting. thanks Dan
          Hide
          ybozhko Yuliya Bozhko added a comment -

          Damn, I thought no one would notice and it will go through as it is Will put it on github

          Yuliya

          Show
          ybozhko Yuliya Bozhko added a comment - Damn, I thought no one would notice and it will go through as it is Will put it on github Yuliya
          Hide
          emmarichardson Emma Richardson added a comment -

          Just a thought but a more accurate test would be to turn off slash arguments first, then upload the image and see it if displays. If someone has slash arguments off, they are not going to want to turn it on every time they have to upload an image file for a badge!

          Show
          emmarichardson Emma Richardson added a comment - Just a thought but a more accurate test would be to turn off slash arguments first, then upload the image and see it if displays. If someone has slash arguments off, they are not going to want to turn it on every time they have to upload an image file for a badge!
          Hide
          ybozhko Yuliya Bozhko added a comment -

          Thanks Emma! Already changed test instructions too

          Show
          ybozhko Yuliya Bozhko added a comment - Thanks Emma! Already changed test instructions too
          Hide
          poltawski Dan Poltawski added a comment -

          Thanks Yuliya, looks good - sending for integration

          Show
          poltawski Dan Poltawski added a comment - Thanks Yuliya, looks good - sending for integration
          Hide
          poltawski Dan Poltawski added a comment -

          Oops, peer reviewed this.

          Show
          poltawski Dan Poltawski added a comment - Oops, peer reviewed this.
          Hide
          damyon Damyon Wiese added a comment -

          Thanks Yuliya,

          This change looks good to me too.

          Integrated to 25 and master.

          Show
          damyon Damyon Wiese added a comment - Thanks Yuliya, This change looks good to me too. Integrated to 25 and master.
          Hide
          dmonllao David Monllaó added a comment -

          It passes, tested in 25 and master

          Show
          dmonllao David Monllaó added a comment - It passes, tested in 25 and master
          Hide
          damyon Damyon Wiese added a comment -

          Thanks for your efforts. This issue is one of the outstanding issues that passed all our testing and was accepted into Moodle this week.

          Hurray!

          Show
          damyon Damyon Wiese added a comment - Thanks for your efforts. This issue is one of the outstanding issues that passed all our testing and was accepted into Moodle this week. Hurray!
          Hide
          mrben33 Ben Hart added a comment -

          Hello. We're having this exact issue on our site and our IT developer isn't comfortable with Linux patches. Can anyone help out with the patch? Or as it's been accepted can we just upgrade to 2.5.1?

          Show
          mrben33 Ben Hart added a comment - Hello. We're having this exact issue on our site and our IT developer isn't comfortable with Linux patches. Can anyone help out with the patch? Or as it's been accepted can we just upgrade to 2.5.1?
          Hide
          ybozhko Yuliya Bozhko added a comment -

          Hi Ben,

          You will need to upgrade to Moodle 2.5.2 as this patch was included in this latest release.

          Yuliya

          Show
          ybozhko Yuliya Bozhko added a comment - Hi Ben, You will need to upgrade to Moodle 2.5.2 as this patch was included in this latest release. Yuliya

            People

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

              Dates

              • Created:
                Updated:
                Resolved:
                Fix Release Date:
                9/Sep/13