1
0
mirror of https://github.com/laravel/valet.git synced 2026-02-06 00:40:06 +01:00

Checks to see if file_exists *and* it's an actual file.

The current check short-circuits too early, allowing the existence of a folder at $uri
to trigger a false positive. This verifies that the file at $uri is actually a file before
returning.
This commit is contained in:
Glendon Solsberry
2017-07-18 09:57:41 -04:00
committed by GitHub
parent 995f2d8457
commit 9f70e8163f

View File

@@ -26,7 +26,8 @@ public function serves($sitePath, $siteName, $uri)
*/
public function isStaticFile($sitePath, $siteName, $uri)
{
if (file_exists($staticFilePath = $sitePath.'/public'.$uri)) {
if (file_exists($staticFilePath = $sitePath.'/public'.$uri)
&& is_file($staticFilePath)) {
return $staticFilePath;
}