This commit is contained in:
2025-03-12 09:36:26 +08:00
parent b98464d8b5
commit 6053fba1da
22 changed files with 286 additions and 228 deletions
+1 -1
View File
@@ -9,7 +9,7 @@ const ImageServer = http.createServer((req, res) => {
// 图片存储的文件夹路径
const directoryPath = path.join(__dirname, '../images');
// 请求的图片文件名
const filePath = path.join(directoryPath, req.url);
const filePath = path.join(directoryPath, decodeURIComponent(req.url));
// 确保文件存在且是文件,不是目录
fs.access(filePath, fs.constants.F_OK | fs.constants.R_OK, (err) => {
if (err) {