This commit is contained in:
Daniel 2025-04-21 12:05:45 +08:00
parent 49c2e407d8
commit ea6edc87a3
No known key found for this signature in database
GPG Key ID: 86211BA83DF03017

View File

@ -18,6 +18,7 @@ package api
import (
"io"
"mime"
"net/http"
"os"
"path"
@ -653,6 +654,11 @@ func exportAsFile(c *gin.Context) {
}
name := "file-" + file.Filename
typ := form.Value["type"][0]
exts, _ := mime.ExtensionsByType(typ)
if 0 < len(exts) {
name += exts[0]
}
name = util.FilterFileName(name)
tmpDir := filepath.Join(util.TempDir, "export")
if err = os.MkdirAll(tmpDir, 0755); err != nil {