mirror of
https://github.com/1f349/dendrite.git
synced 2024-11-22 11:41:38 +00:00
mediaapi/writers: Minor improvements to comments
This commit is contained in:
parent
a3aaa86ea3
commit
2fa0ae29d7
@ -78,7 +78,6 @@ func (r *downloadRequest) jsonErrorResponse(w http.ResponseWriter, res util.JSON
|
||||
|
||||
// Validate validates the downloadRequest fields
|
||||
func (r *downloadRequest) Validate() *util.JSONResponse {
|
||||
// FIXME: the following errors aren't bad JSON, rather just a bad request path
|
||||
// maybe give the URL pattern in the routing, these are not even possible as the handler would not be hit...?
|
||||
if r.MediaMetadata.MediaID == "" {
|
||||
return &util.JSONResponse{
|
||||
|
@ -35,13 +35,13 @@ type uploadRequest struct {
|
||||
Logger *log.Entry
|
||||
}
|
||||
|
||||
// uploadResponse defines the format of the JSON response
|
||||
// https://matrix.org/docs/spec/client_server/r0.2.0.html#post-matrix-media-r0-upload
|
||||
type uploadResponse struct {
|
||||
ContentURI string `json:"content_uri"`
|
||||
}
|
||||
|
||||
// Upload implements /upload
|
||||
//
|
||||
// This endpoint involves uploading potentially significant amounts of data to the homeserver.
|
||||
// This implementation supports a configurable maximum file size limit in bytes. If a user tries to upload more than this, they will receive an error that their upload is too large.
|
||||
// Uploaded files are processed piece-wise to avoid DoS attacks which would starve the server of memory.
|
||||
@ -63,8 +63,8 @@ func Upload(req *http.Request, cfg *config.MediaAPI) util.JSONResponse {
|
||||
}
|
||||
|
||||
// parseAndValidateRequest parses the incoming upload request to validate and extract
|
||||
// all the metadata about the media being uploaded. Returns either an uploadRequest or
|
||||
// an error formatted as a util.JSONResponse
|
||||
// all the metadata about the media being uploaded.
|
||||
// Returns either an uploadRequest or an error formatted as a util.JSONResponse
|
||||
func parseAndValidateRequest(req *http.Request, cfg *config.MediaAPI) (*uploadRequest, *util.JSONResponse) {
|
||||
if req.Method != "POST" {
|
||||
return nil, &util.JSONResponse{
|
||||
|
Loading…
Reference in New Issue
Block a user