summary refs log tree commit diff
path: root/synapse/media/media_storage.py (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Store hashes of media files, and allow quarantining by hash. (#18277)Will Hunt2025-03-271-1/+83
| | | | | | | | | | | | | | | | This PR makes a few radical changes to media. This now stores the SHA256 hash of each file stored in the database (excluding thumbnails, more on that later). If a set of media is quarantined, any additional uploads of the same file contents or any other files with the same hash will be quarantined at the same time. Currently this does NOT: - De-duplicate media, although a future extension could be to do that. - Run any background jobs to identify the hashes of older files. This could also be a future extension, though the value of doing so is limited to combat the abuse of recent media. - Hash thumbnails. It's assumed that thumbnails are parented to some form of media, so you'd likely be wanting to quarantine the media and the thumbnail at the same time.
* Fix zero length media handling (#17570)Erik Johnston2024-08-191-1/+1
| | | | | | | | | | | | | | | | | | | Results in: ``` AssertionError: null File "synapse/http/server.py", line 332, in _async_render_wrapper callback_return = await self._async_render(request) File "synapse/http/server.py", line 544, in _async_render callback_return = await raw_callback_return File "synapse/federation/transport/server/_base.py", line 369, in new_func response = await func( File "synapse/federation/transport/server/federation.py", line 826, in on_GET await self.media_repo.get_local_media( File "synapse/media/media_repository.py", line 473, in get_local_media await respond_with_multipart_responder( File "synapse/media/_base.py", line 353, in respond_with_multipart_responder assert content_length is not None ```
* Use a larger, dedicated threadpool for media sending (#17564)Erik Johnston2024-08-131-7/+5
|
* Speed up responding to media requests (#17558)Erik Johnston2024-08-131-11/+8
| | | | | | | We do this by reading from a threadpool, rather than blocking the main thread. This is broadly what we do in the [S3 storage provider](https://github.com/matrix-org/synapse-s3-storage-provider/blob/main/s3_storage_provider.py#L234)
* Support MSC3916 by adding `_matrix/client/v1/media/download` endpoint (#17365)Shay2024-07-021-11/+16
|
* Re-introduce federation /download endpoint (#17350)Shay2024-06-251-3/+256
|
* Revert "Support MSC3916 by adding a federation `/download` endpoint" (#17325)Andrew Morgan2024-06-181-215/+8
|
* Support MSC3916 by adding a federation `/download` endpoint (#17172)Shay2024-06-071-8/+215
|
* Ensure we delete media if we reject due to spam check (#17246)Erik Johnston2024-05-301-32/+27
| | | | | | | | Fixes up #17239 We need to keep the spam check within the `try/except` block. Also makes it so that we don't enter the top span twice. Also also ensures that we get the right thumbnail length.
* Fix slipped logging context when media rejected (#17239)Erik Johnston2024-05-291-65/+37
| | | | | | | When a module rejects a piece of media we end up trying to close the same logging context twice. Instead of fixing the existing code we refactor to use an async context manager, which is easier to write correctly.
* Correctly mention previous copyright (#16820)Erik Johnston2024-01-231-0/+1
| | | | | During the migration the automated script to update the copyright headers accidentally got rid of some of the existing copyright lines. Reinstate them.
* Update license headersPatrick Cloke2023-11-211-10/+16
|
* Make the media `/upload` tracing less ambiguous (#15888)Eric Eastwood2023-07-101-30/+48
| | | | | | | | | | A lot of the functions have the same name in this space like `store_file`, and we also do it multiple times for different reasons (main media repo, other storage providers, thumbnails, etc) so it's good to differentiate them so your head doesn't explode. Follow-up to https://github.com/matrix-org/synapse/pull/15850 Tracing instrumentation to media `/upload` code paths to investigate https://github.com/matrix-org/synapse/issues/15841
* Add tracing to media `/upload` endpoint (#15850)Eric Eastwood2023-07-051-0/+7
| | | Add tracing instrumentation to media `/upload` code paths to investigate https://github.com/matrix-org/synapse/issues/15841
* Move Spam Checker callbacks to a dedicated file (#15453)Andrew Morgan2023-04-181-4/+3
|
* Refactor media modules. (#15146)Patrick Cloke2023-02-271-0/+374
* Removes the `v1` directory from `test.rest.media.v1`. * Moves the non-REST code from `synapse.rest.media.v1` to `synapse.media`. * Flatten the `v1` directory from `synapse.rest.media`, but leave compatiblity with 3rd party media repositories and spam checkers.