Skip to content

Commit a5f9a79

Browse files
committed
fix: Add method test is subfolder
1 parent 3b86c1a commit a5f9a79

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

‎system/Commands/Translation/LocalizationFinder.php‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ public function run(array $params)
7878
return EXIT_USER_INPUT;
7979
}
8080

81-
if (str_starts_with($tempCurrentDir, $this->languagePath)) {
81+
if ($this->isSubDirectory($tempCurrentDir, $this->languagePath)) {
8282
CLI::error('Error: Directory "' . $this->languagePath . '" restricted to scan.');
8383

8484
return EXIT_USER_INPUT;
@@ -342,4 +342,9 @@ private function writeIsVerbose(string $text = '', ?string $foreground = null, ?
342342
CLI::write($text, $foreground, $background);
343343
}
344344
}
345+
346+
public function isSubDirectory(string $directory, string $rootDirectory): bool
347+
{
348+
return 0 === strncmp($directory, $rootDirectory, strlen($directory));
349+
}
345350
}

0 commit comments

Comments
 (0)