fix repos containing supplementary .md files
[mdref/mdref] / mdref / Action.php
index 68f64a7edb8f41a4293af90ae4ce3d162187a68d..19cf9106f363c9edb6e89e1b83a9cd6fa6aa5ac0 100644 (file)
@@ -97,6 +97,7 @@ class Action {
        /**
         * Serve a preset
         * @param \stdClass $pld
+        * @return true to continue serving the payload
         * @throws Exception
         */
        private function servePreset($pld) {
@@ -105,16 +106,17 @@ class Action {
                case "LICENSE":
                case "VERSION":
                        $pld->text = file_get_contents(ROOT."/$pld->ref");
-                       break;
+                       return true;
                case "index.css":
-                       $this->serveStylesheet($ctl);
+                       $this->serveStylesheet();
                        break;
                case "index.js":
-                       $this->serveJavascript($ctl);
+                       $this->serveJavascript();
                        break;
                default:
                        throw new Exception(404, "$pld->ref not found");
                }
+               return false;
        }
 
        private function serve() {
@@ -138,8 +140,8 @@ class Action {
                                                /* direct match */
                                                $pld->entry = $repo->getEntry($pld->ref);
                                        }
-                               } else {
-                                       return $this->servePreset($pld);
+                               } elseif (!$this->servePreset($pld)) {
+                                       return;
                                }
                        }