浏览代码

Trap empty $requestFileParts

Daniel Rudolf 9 年之前
父节点
当前提交
647a7b5bb7
共有 1 个文件被更改,包括 5 次插入0 次删除
  1. 5 0
      lib/Pico.php

+ 5 - 0
lib/Pico.php

@@ -575,6 +575,11 @@ class Pico
                 $requestFileParts[] = $requestUrlPart;
                 $requestFileParts[] = $requestUrlPart;
             }
             }
 
 
+            if (empty($requestFileParts)) {
+                $this->requestFile = $this->getConfig('content_dir') . 'index' . $this->getConfig('content_ext');
+                return;
+            }
+
             // discover the content file to serve
             // discover the content file to serve
             // Note: $requestFileParts neither contains a trailing nor a leading slash
             // Note: $requestFileParts neither contains a trailing nor a leading slash
             $this->requestFile = $this->getConfig('content_dir') . implode('/', $requestFileParts);
             $this->requestFile = $this->getConfig('content_dir') . implode('/', $requestFileParts);