mirror of
https://github.com/BookStackApp/BookStack.git
synced 2025-02-24 18:53:43 +08:00

Allows files to be placed within a "public" folder within a theme directory which the contents of will served by BookStack for access. - Only "web safe" content-types are provided. - A static 1 day cache time it set on served files. For #3904
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);
|
|
}
|
|
}
|