mirror of
https://github.com/BookStackApp/BookStack.git
synced 2025-02-25 03:13:26 +08:00
18 lines
369 B
PHP
18 lines
369 B
PHP
![]() |
<?php
|
||
|
|
||
|
namespace BookStack\Util;
|
||
|
|
||
|
use League\Flysystem\WhitespacePathNormalizer;
|
||
|
|
||
|
/**
|
||
|
* Utility to normalize (potentially) user provided file paths
|
||
|
* to avoid things like directory traversal.
|
||
|
*/
|
||
|
class FilePathNormalizer
|
||
|
{
|
||
|
public static function normalize(string $path): string
|
||
|
{
|
||
|
return (new WhitespacePathNormalizer())->normalizePath($path);
|
||
|
}
|
||
|
}
|