Moodle
  1. Moodle
  2. MDL-35379

Invalid JSON string in webdav repository when path is '/'

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.1.8, 2.2.5
    • Fix Version/s: 2.2.6
    • Component/s: Repositories
    • Labels:
    • Testing Instructions:
      Hide
      1. Set up a WebDAV repository which as '/' as path
      2. Set up another WebDAV repository which as a different path than just '/', '/webdav' for instance.
      3. Make sure you can browse both repositories and download files
      Show
      Set up a WebDAV repository which as '/' as path Set up another WebDAV repository which as a different path than just '/', '/webdav' for instance. Make sure you can browse both repositories and download files
    • Affected Branches:
      MOODLE_21_STABLE, MOODLE_22_STABLE
    • Fixed Branches:
      MOODLE_22_STABLE
    • Pull from Repository:

      Description

      We've had this issue reported to us by a client and since I don't have a webdav repository set up I haven't been able to confirm or test the issue. However I think I've isolated the problem and my proposed patch seemed to fix it for them so here it is!

      When viewing the webdav repository in the filepicker they get the error:

      ERROR: Invalid JSON string 
      Warning: strpos(): Empty delimiter in /var/www/htdocs/repository/webdav/lib.php on line 146 
      {"dynload":true,"nosearch":true,"nologin":true,"path":[{"name":"WebDAV","path":0}],"list":[{"title":"test","thumbnail"...

      From what I can tell, if the path is just a single slash '/' path will end up being an empty string as the line before is:

      $path = rtrim($path,'/');

      This doesn't seem to affect 2.3 following the changes made in http://tracker.moodle.org/browse/MDL-32497.

      Sorry I can't provide any more information!

        Gliffy Diagrams

          Issue Links

            Activity

            Hide
            Michael de Raadt added a comment -

            Thanks for reporting that and providing a patch. If any further details come to you, please add them to this issue.

            Show
            Michael de Raadt added a comment - Thanks for reporting that and providing a patch. If any further details come to you, please add them to this issue.
            Hide
            Frédéric Massart added a comment -

            I am pushing for peer review the branch which include Simon's patch.

            Simon, I have set yourself as the author of the patch, if you'd prefer not having your email address present there, please let me know I will remove it.

            @ Integrators: 2.2 only!

            Show
            Frédéric Massart added a comment - I am pushing for peer review the branch which include Simon's patch. Simon, I have set yourself as the author of the patch, if you'd prefer not having your email address present there, please let me know I will remove it. @ Integrators: 2.2 only!
            Hide
            Simon Coggins added a comment -

            Hi Frédéric,

            Thank you - I'm okay with using my email.

            Show
            Simon Coggins added a comment - Hi Frédéric, Thank you - I'm okay with using my email.
            Hide
            Ankit Agarwal added a comment -

            I am not really familiar with webdav repo. But the changes looks good to me and they make sense.

            pushing for integration.
            Thanks

            Show
            Ankit Agarwal added a comment - I am not really familiar with webdav repo. But the changes looks good to me and they make sense. pushing for integration. Thanks
            Hide
            Sam Hemelryk added a comment -

            Thanks for spotting and fixing guys, this has been integrated now

            Show
            Sam Hemelryk added a comment - Thanks for spotting and fixing guys, this has been integrated now
            Hide
            Michael de Raadt added a comment -

            Test result: Success!

            Show
            Michael de Raadt added a comment - Test result: Success!
            Hide
            Dan Poltawski added a comment -

            Congratulations, you've done it!

            Nf n erjneq sbe fhpprfshy vagrtengvba vagb guvf jrrxf eryrnfr, V pna abj qvfpybfr gb lbh gur rkvfgnapr bs shapgvba fge_ebg13(), gb tb va lbhe gbbyxvg nybat jvgu uggc://cuc.arg/znahny/ra/shapgvba.tmtrgff.cuc

            Cyrnfr qb abg nyybj guvf vasbezngvba gb cnff shegure.

            Show
            Dan Poltawski added a comment - Congratulations, you've done it! Nf n erjneq sbe fhpprfshy vagrtengvba vagb guvf jrrxf eryrnfr, V pna abj qvfpybfr gb lbh gur rkvfgnapr bs shapgvba fge_ebg13(), gb tb va lbhe gbbyxvg nybat jvgu uggc://cuc.arg/znahny/ra/shapgvba.tmtrgff.cuc Cyrnfr qb abg nyybj guvf vasbezngvba gb cnff shegure.

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved: