添加镜像数量限制

This commit is contained in:
NewName
2025-05-18 15:54:41 +08:00
parent 5d41fa979e
commit 2f6dcb724b

View File

@@ -360,6 +360,12 @@ func handleDownload(c *gin.Context) {
return
}
// 添加镜像数量限制10个防止恶意刷流量
if len(req.Images) > 10 {
c.JSON(http.StatusBadRequest, gin.H{"error": "您下载的数量太多,宝宝承受不住"})
return
}
// 创建新任务
taskID := generateTaskID()
tempDir := filepath.Join("./temp", taskID)