From 21c3b0d83f2ce6a499a71d811ca11edfb9fd1586 Mon Sep 17 00:00:00 2001 From: Thomas Hochstein Date: Wed, 25 Mar 2020 13:47:17 +0100 Subject: [PATCH] Add missing active content check for renaming. After fixing the other ML file renaming bugs, it was now possible to rename a file without extension into a file that *does* have an extension - so we need to check against active content. Signed-off-by: Thomas Hochstein --- include/functions_images.inc.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/include/functions_images.inc.php b/include/functions_images.inc.php index 7c54317a..27ee11ed 100644 --- a/include/functions_images.inc.php +++ b/include/functions_images.inc.php @@ -2261,6 +2261,10 @@ function serendipity_renameFile($id, $newName, $path = null) { $newPath = $imgBase . $path . $newName . (empty($File['extension']) ? '' : '.' . $File['extension']); + if (serendipity_isActiveFile($newName) || serendipity_isActiveFile($newPath)) { + return sprintf(' ' . ERROR_FILE_FORBIDDEN . "\n", $newName); + } + if (file_exists($newPath)) { return sprintf(' ' . ERROR_FILE_EXISTS . "\n", $newName); }