This commit is contained in:
wood chen 2024-09-29 01:39:46 +08:00
parent 214d189e24
commit 85362aad22

View File

@ -214,7 +214,7 @@ func Convert(c *fiber.Ctx) error {
// 新增:检查文件是否为图片的辅助函数 // 新增:检查文件是否为图片的辅助函数
func isImageFile(filename string) bool { func isImageFile(filename string) bool {
ext := strings.ToLower(path.Ext(filename)) ext := strings.ToLower(path.Ext(filename))
allowedExtensions := []string{"jpg","png","jpeg","gif","bmp","svg","heic","nef",".webp",".tiff"} allowedExtensions := []string{".jpg",".png",".jpeg",".gif",".bmp",".svg",".heic",".nef",".webp",".tiff"}
for _, allowedExt := range allowedExtensions { for _, allowedExt := range allowedExtensions {
if ext == allowedExt { if ext == allowedExt {
return true return true