Bläddra i källkod

Trap empty $requestFileParts

Daniel Rudolf 9 år sedan
förälder
incheckning
647a7b5bb7
1 ändrade filer med 5 tillägg och 0 borttagningar
  1. 5 0
      lib/Pico.php

+ 5 - 0
lib/Pico.php

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