From 4fd97df2c5ac86bf908432d29259bdda5912b89b Mon Sep 17 00:00:00 2001 From: Neil Alexander Date: Mon, 11 May 2020 11:01:24 +0100 Subject: [PATCH 1/2] Don't return 500s from media API download requests --- mediaapi/routing/download.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/mediaapi/routing/download.go b/mediaapi/routing/download.go index 8544bd64f..9feca90e9 100644 --- a/mediaapi/routing/download.go +++ b/mediaapi/routing/download.go @@ -118,7 +118,10 @@ func Download( ) if err != nil { // TODO: Handle the fact we might have started writing the response - dReq.jsonErrorResponse(w, util.ErrorResponse(err)) + dReq.jsonErrorResponse(w, util.JSONResponse{ + Code: http.StatusNotFound, + JSON: jsonerror.NotFound("Failed to download: " + err.Error()), + }) return } @@ -138,7 +141,7 @@ func (r *downloadRequest) jsonErrorResponse(w http.ResponseWriter, res util.JSON if err != nil { r.Logger.WithError(err).Error("Failed to marshal JSONResponse") // this should never fail to be marshalled so drop err to the floor - res = util.MessageResponse(http.StatusInternalServerError, "Internal Server Error") + res = util.MessageResponse(http.StatusNotFound, "Download request failed: "+err.Error()) resBytes, _ = json.Marshal(res.JSON) } From 6e643860b12dbcf910fb6c7ba6d27f220c9fa594 Mon Sep 17 00:00:00 2001 From: Neil Alexander Date: Mon, 11 May 2020 11:50:29 +0100 Subject: [PATCH 2/2] Update sytest-whitelist --- sytest-whitelist | 1 + 1 file changed, 1 insertion(+) diff --git a/sytest-whitelist b/sytest-whitelist index c957021cb..6e1b4f631 100644 --- a/sytest-whitelist +++ b/sytest-whitelist @@ -264,3 +264,4 @@ User can invite local user to room with version 5 remote user can join room with version 5 User can invite remote user to room with version 5 Remote user can backfill in a room with version 5 +Alternative server names do not cause a routing loop