mirror of
https://github.com/zulip/zulip.git
synced 2025-11-13 02:17:19 +00:00
python: Simplify with str.removeprefix, str.removesuffix.
These are available in Python ≥ 3.9. https://docs.python.org/3/library/stdtypes.html#str.removeprefix Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
committed by
Tim Abbott
parent
1ec4539550
commit
91ade25ba3
@@ -239,7 +239,7 @@ class LocalUploadBackend(ZulipUploadBackend):
|
||||
def delete_export_tarball(self, export_path: str) -> str | None:
|
||||
# Get the last element of a list in the form ['user_avatars', '<file_path>']
|
||||
assert export_path.startswith("/")
|
||||
file_path = export_path[1:].split("/", 1)[-1]
|
||||
file_path = export_path.removeprefix("/").split("/", 1)[-1]
|
||||
if delete_local_file("avatars", file_path):
|
||||
return export_path
|
||||
return None
|
||||
|
||||
Reference in New Issue
Block a user