mediaapi/writers: Minor improvements to comments
MODIFY
src/github.com/matrix-org/dendrite/mediaapi/writers/download.go
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{

MODIFY
src/github.com/matrix-org/dendrite/mediaapi/writers/upload.go
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{

mediaapi/writers: Minor improvements to comments