mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-08-17 19:20:21 -04:00
Merge remote-tracking branch 'upstream/release-v1.53'
This commit is contained in:
commit
d12ff25f13
148 changed files with 4222 additions and 2281 deletions
|
@ -403,6 +403,7 @@ class PreviewUrlResource(DirectServeJsonResource):
|
|||
output_stream=output_stream,
|
||||
max_size=self.max_spider_size,
|
||||
headers={"Accept-Language": self.url_preview_accept_language},
|
||||
is_allowed_content_type=_is_previewable,
|
||||
)
|
||||
except SynapseError:
|
||||
# Pass SynapseErrors through directly, so that the servlet
|
||||
|
@ -761,3 +762,10 @@ def _is_html(content_type: str) -> bool:
|
|||
|
||||
def _is_json(content_type: str) -> bool:
|
||||
return content_type.lower().startswith("application/json")
|
||||
|
||||
|
||||
def _is_previewable(content_type: str) -> bool:
|
||||
"""Returns True for content types for which we will perform URL preview and False
|
||||
otherwise."""
|
||||
|
||||
return _is_html(content_type) or _is_media(content_type) or _is_json(content_type)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue