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:
JWT_SECRET: supersecretkey
PORT: 8000
ADMIN_PASSWORD: ""
DB_TYPE: sqlite
DATABASE_URL: ./data/database.db

View File

@@ -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().
@@ -490,4 +491,4 @@ func (h *Handler) UploadStatus(c *gin.Context) {
c.JSON(200, gin.H{
"uploadedChunks": uploaded,
})
}
}