diff options
author | Robert Long <robert@robertlong.me> | 2022-06-27 06:44:05 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-06-27 14:44:05 +0100 |
commit | 9b683ea80f94de4249264cbf375523b987900c89 (patch) | |
tree | b96da6baec0589be6fabda401ad2fdf7219adc81 /synapse/rest/media/v1/thumbnail_resource.py | |
parent | Refactor the Dockerfile-workers configuration script to use Jinja2 templates ... (diff) | |
download | synapse-9b683ea80f94de4249264cbf375523b987900c89.tar.xz |
Add Cross-Origin-Resource-Policy header to thumbnail and download media endpoints (#12944)
Diffstat (limited to 'synapse/rest/media/v1/thumbnail_resource.py')
-rw-r--r-- | synapse/rest/media/v1/thumbnail_resource.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/synapse/rest/media/v1/thumbnail_resource.py b/synapse/rest/media/v1/thumbnail_resource.py index 53b1565243..2295adfaa7 100644 --- a/synapse/rest/media/v1/thumbnail_resource.py +++ b/synapse/rest/media/v1/thumbnail_resource.py @@ -18,7 +18,11 @@ import logging from typing import TYPE_CHECKING, Any, Dict, List, Optional, Tuple from synapse.api.errors import SynapseError -from synapse.http.server import DirectServeJsonResource, set_cors_headers +from synapse.http.server import ( + DirectServeJsonResource, + set_corp_headers, + set_cors_headers, +) from synapse.http.servlet import parse_integer, parse_string from synapse.http.site import SynapseRequest from synapse.rest.media.v1.media_storage import MediaStorage @@ -58,6 +62,7 @@ class ThumbnailResource(DirectServeJsonResource): async def _async_render_GET(self, request: SynapseRequest) -> None: set_cors_headers(request) + set_corp_headers(request) server_name, media_id, _ = parse_media_id(request) width = parse_integer(request, "width", required=True) height = parse_integer(request, "height", required=True) |