fix admin download filename
This commit is contained in:
@@ -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
|
||||||
|
|||||||
@@ -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().
|
||||||
@@ -490,4 +491,4 @@ func (h *Handler) UploadStatus(c *gin.Context) {
|
|||||||
c.JSON(200, gin.H{
|
c.JSON(200, gin.H{
|
||||||
"uploadedChunks": uploaded,
|
"uploadedChunks": uploaded,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user