Skip to content

Commit bd18fee

Browse files
committed
Fixed checking .. paths.
1 parent ac64c27 commit bd18fee

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/DocParser.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,11 @@ public function __construct(DocFile $file)
6565
$this->config = $this->file->getManager()->getConfiguration();
6666
}
6767

68+
public function getConfig(): DocsConfig
69+
{
70+
return $this->config;
71+
}
72+
6873
private function parse() : void
6974
{
7075
if(isset($this->html)) {
@@ -219,7 +224,7 @@ private function preParseInjectIncludes(string $text) : string
219224
public function findIncludeFile(string $relativePath) : FileInfo
220225
{
221226
// Disallow navigating upwards with "../"
222-
if(strpos($relativePath, '..')) {
227+
if(strpos($relativePath, '..') !== false) {
223228
throw new DocsException(
224229
'Navigating upwards from include folders is not allowed.',
225230
'',
@@ -231,7 +236,7 @@ public function findIncludeFile(string $relativePath) : FileInfo
231236

232237
if(!in_array($ext, $this->config->getIncludeExtensions(), true)) {
233238
throw new DocsException(
234-
sprintf('The extension %s is not allowed.', $ext),
239+
sprintf('The extension [%s] is not allowed.', $ext),
235240
'',
236241
self::ERROR_INVALID_INCLUDE_EXTENSION
237242
);

0 commit comments

Comments
 (0)