Private
Public Access
1
0

新增: 云OSS存储集成(七牛云+阿里云)+多桶导航+GBK编码自动转换

This commit is contained in:
2026-05-05 03:18:47 +08:00
parent eb5b85e007
commit b4f4b4627d
34 changed files with 5225 additions and 48 deletions

View File

@@ -218,9 +218,10 @@ func handleLocalFileRequest(w http.ResponseWriter, r *http.Request) {
}
log.Printf("[LocalFileHandler] 最终路径: %s", filePath)
// 🔒 文件类型白名单检查
// 🔒 文件类型白名单检查(临时目录文件放行,用于 OSS/SFTP 预览)
ext := strings.ToLower(filepath.Ext(filePath))
if !isAllowedFileType(ext) {
isTemp := strings.HasPrefix(filePath, os.TempDir())
if !isTemp && !isAllowedFileType(ext) {
log.Printf("[LocalFileHandler] 不允许的文件类型: %s", ext)
http.Error(w, fmt.Sprintf("Forbidden file type: %s", ext), http.StatusForbidden)
return