mirror of
https://mau.dev/maunium/synapse.git
synced 2024-10-01 01:36:05 -04:00
Disable directory listing for StaticResource
(#15438)
This commit is contained in:
parent
e4a25d022c
commit
24b61f32ff
1
changelog.d/15438.misc
Normal file
1
changelog.d/15438.misc
Normal file
@ -0,0 +1 @@
|
|||||||
|
Disable directory listing for static resources in `/_matrix/static/`.
|
@ -46,6 +46,13 @@ from twisted.internet import defer, interfaces
|
|||||||
from twisted.internet.defer import CancelledError
|
from twisted.internet.defer import CancelledError
|
||||||
from twisted.python import failure
|
from twisted.python import failure
|
||||||
from twisted.web import resource
|
from twisted.web import resource
|
||||||
|
|
||||||
|
try:
|
||||||
|
from twisted.web.pages import notFound
|
||||||
|
except ImportError:
|
||||||
|
from twisted.web.resource import NoResource as notFound # type: ignore[assignment]
|
||||||
|
|
||||||
|
from twisted.web.resource import IResource
|
||||||
from twisted.web.server import NOT_DONE_YET, Request
|
from twisted.web.server import NOT_DONE_YET, Request
|
||||||
from twisted.web.static import File
|
from twisted.web.static import File
|
||||||
from twisted.web.util import redirectTo
|
from twisted.web.util import redirectTo
|
||||||
@ -569,6 +576,9 @@ class StaticResource(File):
|
|||||||
set_clickjacking_protection_headers(request)
|
set_clickjacking_protection_headers(request)
|
||||||
return super().render_GET(request)
|
return super().render_GET(request)
|
||||||
|
|
||||||
|
def directoryListing(self) -> IResource:
|
||||||
|
return notFound()
|
||||||
|
|
||||||
|
|
||||||
class UnrecognizedRequestResource(resource.Resource):
|
class UnrecognizedRequestResource(resource.Resource):
|
||||||
"""
|
"""
|
||||||
|
Loading…
Reference in New Issue
Block a user