From 8feaeb50058f2f3c6b03d0856c4e393d9f804ee4 Mon Sep 17 00:00:00 2001 From: Josh Bruce Date: Tue, 23 May 2023 20:48:27 -0400 Subject: [PATCH] add: Affordance for sending path without leading forward slash --- src/FileSystem/Files/PublicFile.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/FileSystem/Files/PublicFile.php b/src/FileSystem/Files/PublicFile.php index f4e5772..bfde9f3 100644 --- a/src/FileSystem/Files/PublicFile.php +++ b/src/FileSystem/Files/PublicFile.php @@ -36,6 +36,10 @@ public static function inPublicRoot( $at = substr($at, 0, -1); } + if (str_starts_with($at, '/') === false) { + $at = '/' . $at; + } + return new self($root, $filename, $at); }