Skip to content

Commit

Permalink
move server_name fetch in synadm media delete down
Browse files Browse the repository at this point in the history
only when necessary, which is only one case
  • Loading branch information
JacksonChen666 committed Apr 3, 2024
1 parent 48fa5de commit 17d4d92
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions synadm/cli/media.py
Expand Up @@ -266,17 +266,15 @@ def media_delete_cmd(helper, media_id, before_days, before, before_ts,
To delete cached remote media, use `synadm media purge`
"""
server_name = helper.retrieve_homeserver_name(helper.config["base_url"])
if not server_name:
media_deleted = None
elif media_id and delete_profiles:
if media_id and delete_profiles:
click.echo("Combination of --media-id and --delete-profiles not "
"valid.")
media_deleted = None
elif media_id and size:
click.echo("Combination of --media-id and --size not valid.")
media_deleted = None
elif media_id:
server_name = helper.retrieve_homeserver_name(helper.config["base_url"])
media_deleted = helper.api.media_delete(server_name, media_id)
else:
media_deleted = helper.api.media_delete_by_date_or_size(
Expand Down

0 comments on commit 17d4d92

Please sign in to comment.