mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-07 23:13:11 -06:00
mediaapi/writers/download: Only accept GET method
This commit is contained in:
parent
10e843da58
commit
90bac42edb
|
|
@ -72,10 +72,18 @@ func jsonErrorResponse(w http.ResponseWriter, res util.JSONResponse, logger *log
|
|||
w.Write(resBytes)
|
||||
}
|
||||
|
||||
// Download implements /upload
|
||||
// Download implements /download
|
||||
func Download(w http.ResponseWriter, req *http.Request, serverName string, mediaID string, cfg config.MediaAPI, db *storage.Database, downloadServer DownloadServer) {
|
||||
logger := util.GetLogger(req.Context())
|
||||
|
||||
if req.Method != "GET" {
|
||||
jsonErrorResponse(w, util.JSONResponse{
|
||||
Code: 405,
|
||||
JSON: jsonerror.Unknown("request method must be GET"),
|
||||
}, logger)
|
||||
return
|
||||
}
|
||||
|
||||
r := &DownloadRequest{
|
||||
MediaID: mediaID,
|
||||
ServerName: serverName,
|
||||
|
|
|
|||
Loading…
Reference in a new issue