File tree Expand file tree Collapse file tree 1 file changed +12
-6
lines changed
Expand file tree Collapse file tree 1 file changed +12
-6
lines changed Original file line number Diff line number Diff line change 2323import logging
2424import re
2525
26+ from synapse .api .errors import SynapseError , cs_error , Codes
2627from synapse .http .server import (
2728 HttpServer ,
2829 respond_with_json ,
@@ -238,12 +239,17 @@ async def on_GET(
238239 requester = await self .auth .get_user_by_req (request , allow_guest = True )
239240 is_admin = await self .auth .is_server_admin (requester )
240241 bypass_quarantine = False
241- if (
242- is_admin
243- and parse_string (request , "admin_unsafely_bypass_quarantine" ) == "true"
244- ):
245- logger .info ("Admin bypassing quarantine for media download" )
246- bypass_quarantine = True
242+ if parse_string (request , "admin_unsafely_bypass_quarantine" ) == "true" :
243+ if is_admin :
244+ logger .info ("Admin bypassing quarantine for media download" )
245+ bypass_quarantine = True
246+ else :
247+ respond_with_json (
248+ request ,
249+ 400 ,
250+ cs_error ("Must be a server admin to bypass quarantine" , code = Codes .UNKNOWN ),
251+ send_cors = True ,
252+ )
247253
248254 set_cors_headers (request )
249255 set_corp_headers (request )
You can’t perform that action at this time.
0 commit comments