diff options
author | Erik Johnston <erik@matrix.org> | 2015-04-27 14:41:40 +0100 |
---|---|---|
committer | Erik Johnston <erik@matrix.org> | 2015-04-27 14:41:40 +0100 |
commit | 6f8e2d517e8141f62cb0cfcc73c3842a367ff21c (patch) | |
tree | 4f4569d1bbf7b6fcc2a67c1664da38b75e81a5ee /synapse/rest/media/v1/download_resource.py | |
parent | Shuffle operations so that locking upsert happens last in the txn. This ensur... (diff) | |
parent | Merge pull request #132 from matrix-org/observer_and_locks (diff) | |
download | synapse-6f8e2d517e8141f62cb0cfcc73c3842a367ff21c.tar.xz |
Merge branch 'develop' of github.com:matrix-org/synapse into postgres
Diffstat (limited to 'synapse/rest/media/v1/download_resource.py')
-rw-r--r-- | synapse/rest/media/v1/download_resource.py | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/synapse/rest/media/v1/download_resource.py b/synapse/rest/media/v1/download_resource.py index c585bb11f7..0fe6abf647 100644 --- a/synapse/rest/media/v1/download_resource.py +++ b/synapse/rest/media/v1/download_resource.py @@ -13,7 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. -from .base_resource import BaseMediaResource +from .base_resource import BaseMediaResource, parse_media_id +from synapse.http.server import request_handler from twisted.web.server import NOT_DONE_YET from twisted.internet import defer @@ -28,15 +29,10 @@ class DownloadResource(BaseMediaResource): self._async_render_GET(request) return NOT_DONE_YET - @BaseMediaResource.catch_errors + @request_handler @defer.inlineCallbacks def _async_render_GET(self, request): - try: - server_name, media_id = request.postpath - except: - self._respond_404(request) - return - + server_name, media_id = parse_media_id(request) if server_name == self.server_name: yield self._respond_local_file(request, media_id) else: |