From 2fa0ae29d77a7d2068eae0b5d652279ea3ed5d87 Mon Sep 17 00:00:00 2001 From: Robert Swain Date: Fri, 26 May 2017 10:03:16 +0200 Subject: [PATCH] mediaapi/writers: Minor improvements to comments --- .../matrix-org/dendrite/mediaapi/writers/download.go | 1 - .../matrix-org/dendrite/mediaapi/writers/upload.go | 6 +++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/github.com/matrix-org/dendrite/mediaapi/writers/download.go b/src/github.com/matrix-org/dendrite/mediaapi/writers/download.go index 82053f14..901745c8 100644 --- a/src/github.com/matrix-org/dendrite/mediaapi/writers/download.go +++ b/src/github.com/matrix-org/dendrite/mediaapi/writers/download.go @@ -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{ diff --git a/src/github.com/matrix-org/dendrite/mediaapi/writers/upload.go b/src/github.com/matrix-org/dendrite/mediaapi/writers/upload.go index 017a0078..42f0bce2 100644 --- a/src/github.com/matrix-org/dendrite/mediaapi/writers/upload.go +++ b/src/github.com/matrix-org/dendrite/mediaapi/writers/upload.go @@ -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{