BookStackApp_BookStack/app/Util/FilePathNormalizer.php
Dan Brown 593645acfe
Themes: Added route to serve public theme files
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
2025-01-13 14:34:44 +00:00

17 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);
}
}