Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Commit

Permalink
Guard against improper implementations.
Browse files Browse the repository at this point in the history
  • Loading branch information
clokep committed Jul 17, 2020
1 parent 6b437bb commit af4f079
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion synapse/rest/media/v1/media_storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
# limitations under the License.

import contextlib
import inspect
import logging
import os
import shutil
Expand Down Expand Up @@ -104,7 +105,11 @@ def store_into_file(self, file_info):

async def finish():
for provider in self.storage_providers:
await provider.store_file(path, file_info)
# store_file is supposed to return an Awaitable or Deferred, but
# guard against improper implementations.
result = provider.store_file(path, file_info)
if inspect.isawaitable(result) or isinstance(result, defer.Deferred):
await result

finished_called[0] = True

Expand Down

0 comments on commit af4f079

Please sign in to comment.