]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-14589 /. files are not created anymore when browsing empty areas, yay!
authorskodak <skodak>
Sun, 7 Sep 2008 22:23:10 +0000 (22:23 +0000)
committerskodak <skodak>
Sun, 7 Sep 2008 22:23:10 +0000 (22:23 +0000)
lib/file/file_browser.php

index 79f8fa1722f77d2a5255927c75cb85f5f8954194..d3150efd81066a236c14732a7018526e08f8bc9d 100644 (file)
@@ -74,9 +74,13 @@ class file_browser {
                     }
                     $urlbase = $CFG->wwwroot.'/draftfile.php';
                     if (!$storedfile = $fs->get_file($context->id, $filearea, $itemid, $filepath, $filename)) {
-                        return null;
+                        if ($filepath === '/' and $filename === '.') {
+                            $storedfile = new virtual_root_file($context->id, $filearea, $itemid);
+                        } else {
+                            // not found
+                            return null;
+                        }
                     }
-                    //something must create the top most directory
                     // TODO: localise
                     return new file_info_stored($this, $context, $storedfile, $urlbase, 'Draft file area', true, true, true);
                 }