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

Refactor media modules #15146

Merged
merged 5 commits into from
Feb 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/15146.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Refactor the media modules.
2 changes: 1 addition & 1 deletion synapse/_scripts/move_remote_media_to_new_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
import shutil
import sys

from synapse.rest.media.v1.filepath import MediaFilePaths
from synapse.media.filepath import MediaFilePaths

logger = logging.getLogger()

Expand Down
12 changes: 7 additions & 5 deletions synapse/config/repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,11 +178,13 @@ def read_config(self, config: JsonDict, **kwargs: Any) -> None:
for i, provider_config in enumerate(storage_providers):
# We special case the module "file_system" so as not to need to
# expose FileStorageProviderBackend
if provider_config["module"] == "file_system":
provider_config["module"] = (
"synapse.rest.media.v1.storage_provider"
".FileStorageProviderBackend"
)
if (
provider_config["module"] == "file_system"
or provider_config["module"] == "synapse.rest.media.v1.storage_provider"
):
provider_config[
"module"
] = "synapse.media.storage_provider.FileStorageProviderBackend"

provider_class, parsed_config = load_module(
provider_config, ("media_storage_providers", "<item %i>" % i)
Expand Down
4 changes: 2 additions & 2 deletions synapse/events/spamcheck.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@
import synapse
from synapse.api.errors import Codes
from synapse.logging.opentracing import trace
from synapse.rest.media.v1._base import FileInfo
from synapse.rest.media.v1.media_storage import ReadableFileWrapper
from synapse.media._base import FileInfo
from synapse.media.media_storage import ReadableFileWrapper
from synapse.spam_checker_api import RegistrationBehaviour
from synapse.types import JsonDict, RoomAlias, UserProfile
from synapse.util.async_helpers import delay_cancellation, maybe_awaitable
Expand Down
Loading