fix admin download filename

This commit is contained in:
2026-05-06 00:32:21 +02:00
parent 1a82f21202
commit a91b9b36d3
2 changed files with 4 additions and 4 deletions

View File

@@ -10,7 +10,6 @@ services:
environment: environment:
JWT_SECRET: supersecretkey JWT_SECRET: supersecretkey
PORT: 8000 PORT: 8000
ADMIN_PASSWORD: ""
DB_TYPE: sqlite DB_TYPE: sqlite
DATABASE_URL: ./data/database.db DATABASE_URL: ./data/database.db

View File

@@ -225,6 +225,9 @@ func (h *Handler) AdminGet(c *gin.Context) {
return 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) 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( record, err := h.service.UploadFile(
req.Filename, req.Filename,
pr, pr,
@@ -451,7 +453,6 @@ func (h *Handler) UploadComplete(c *gin.Context) {
return return
} }
// cleanup temp
_ = os.RemoveAll(tmpDir) _ = os.RemoveAll(tmpDir)
log.Info(). log.Info().