mirror of
https://github.com/BookStackApp/BookStack.git
synced 2025-01-21 23:48:16 +00:00
593645acfe
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
17 lines
369 B
PHP
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);
|
|
}
|
|
}
|