Skip to content

Commit

Permalink
fix: Prevent adding empty lines
Browse files Browse the repository at this point in the history
  • Loading branch information
rafaucau committed May 16, 2023
1 parent 8164ced commit 7db9b2b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/Middleware/LSCacheControlMiddleware.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public function process(ServerRequestInterface $request, RequestHandlerInterface
$currentPath = Str::of($request->getUri()->getPath());

foreach ($excludedPathsArr as $pattern) {
if ($currentPath->test('/'.addcslashes($pattern, '/').'/')) {
if (! empty(trim($pattern)) && $currentPath->test('/'.addcslashes($pattern, '/').'/')) {
return $this->withCacheControlHeader($response, 'no-cache');
}
}
Expand Down
5 changes: 4 additions & 1 deletion src/Utility/HtaccessManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,10 @@ private function generateLsCacheBlock(): string
$block .= $this->addLine('');

foreach ($dropQsArr as $qs) {
$block .= $this->addLine('CacheKeyModify -qs:'.trim($qs));
$qs = trim($qs);
if (! empty($qs)) {
$block .= $this->addLine('CacheKeyModify -qs:'.$qs);
}
}
}

Expand Down

0 comments on commit 7db9b2b

Please sign in to comment.