mirror of
https://github.com/sbrl/Pepperminty-Wiki.git
synced 2024-12-22 13:45:02 +00:00
makepathsafe: don't allow dots on their own
Specifically, we don't want a single dot as a page name. This is because '.' has a special meaning on Linux: The current directory.
This commit is contained in:
parent
5fed4cb5ab
commit
e710d55883
1 changed files with 2 additions and 0 deletions
|
@ -289,6 +289,8 @@ function makepathsafe($string)
|
|||
$string = preg_replace("/\.+/", ".", $string);
|
||||
// Don't allow slashes at the beginning
|
||||
$string = ltrim($string, "\\/");
|
||||
// Don't allow dots on their own
|
||||
$string = preg_replace(["/^\.\\/|\\/\.$/", "/\\/\.\\//"], ["", "/"], $string);
|
||||
return $string;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue