fix admin download filename
This commit is contained in:
@@ -10,7 +10,6 @@ services:
|
||||
environment:
|
||||
JWT_SECRET: supersecretkey
|
||||
PORT: 8000
|
||||
ADMIN_PASSWORD: ""
|
||||
|
||||
DB_TYPE: sqlite
|
||||
DATABASE_URL: ./data/database.db
|
||||
|
||||
@@ -225,6 +225,9 @@ func (h *Handler) AdminGet(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
c.Header("Content-Disposition", fmt.Sprintf(`inline; filename="%s"`, util.SafeFilename(record.Filename)))
|
||||
c.Header("X-Content-Type-Options", "nosniff")
|
||||
|
||||
c.File(record.Path)
|
||||
}
|
||||
|
||||
@@ -438,7 +441,6 @@ func (h *Handler) UploadComplete(c *gin.Context) {
|
||||
}
|
||||
}()
|
||||
|
||||
// reuse your existing upload logic 👇
|
||||
record, err := h.service.UploadFile(
|
||||
req.Filename,
|
||||
pr,
|
||||
@@ -451,7 +453,6 @@ func (h *Handler) UploadComplete(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
// cleanup temp
|
||||
_ = os.RemoveAll(tmpDir)
|
||||
|
||||
log.Info().
|
||||
|
||||
Reference in New Issue
Block a user