From 2aec731ab16f6a26494a40c215e1adcade11c0d3 Mon Sep 17 00:00:00 2001 From: qkqpttgf <45693631+qkqpttgf@users.noreply.github.com> Date: Sun, 7 Mar 2021 23:07:54 +0800 Subject: [PATCH] try fix #% in file name --- common.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/common.php b/common.php index 0420532..361cea4 100644 --- a/common.php +++ b/common.php @@ -692,6 +692,7 @@ function comppass($pass) function encode_str_replace($str) { + $str = str_replace('%','%25',$str); $str = str_replace('&','&',$str); $str = str_replace('+','%2B',$str); $str = str_replace('#','%23',$str); @@ -2037,7 +2038,8 @@ function render_list($path = '', $files = []) if ($_SERVER['admin'] or !isHideFile($file['name'])) { $filenum++; $ext = strtolower(substr($file['name'], strrpos($file['name'], '.') + 1)); - $FolderListStr = str_replace('', path_format($_SERVER['base_disk_path'] . '/' . $path . '/' . encode_str_replace($file['name'])), $FolderList); + $FolderListStr = $FolderList; + while (strpos($FolderListStr, '')) $FolderListStr = str_replace('', path_format($_SERVER['base_disk_path'] . '/' . $path . '/' . encode_str_replace($file['name'])), $FolderListStr); $FolderListStr = str_replace('', $ext, $FolderListStr); if (in_array($ext, $exts['music'])) $FolderListStr = str_replace('', 'audio', $FolderListStr); elseif (in_array($ext, $exts['video'])) $FolderListStr = str_replace('', 'iframe', $FolderListStr);