mirror of
https://github.com/zulip/zulip.git
synced 2025-11-03 05:23:35 +00:00
upload: Fix typing for key variable.
This commit is contained in:
@@ -316,7 +316,7 @@ def get_signed_upload_url(path: str) -> str:
|
|||||||
|
|
||||||
def get_realm_for_filename(path: str) -> Optional[int]:
|
def get_realm_for_filename(path: str) -> Optional[int]:
|
||||||
conn = S3Connection(settings.S3_KEY, settings.S3_SECRET_KEY)
|
conn = S3Connection(settings.S3_KEY, settings.S3_SECRET_KEY)
|
||||||
key = get_bucket(conn, settings.S3_AUTH_UPLOADS_BUCKET).get_key(path)
|
key = get_bucket(conn, settings.S3_AUTH_UPLOADS_BUCKET).get_key(path) # type: Optional[Key]
|
||||||
if key is None:
|
if key is None:
|
||||||
# This happens if the key does not exist.
|
# This happens if the key does not exist.
|
||||||
return None
|
return None
|
||||||
@@ -328,7 +328,7 @@ class S3UploadBackend(ZulipUploadBackend):
|
|||||||
bucket = get_bucket(conn, bucket_name)
|
bucket = get_bucket(conn, bucket_name)
|
||||||
|
|
||||||
# check if file exists
|
# check if file exists
|
||||||
key = bucket.get_key(path_id)
|
key = bucket.get_key(path_id) # type: Optional[Key]
|
||||||
if key is not None:
|
if key is not None:
|
||||||
bucket.delete_key(key)
|
bucket.delete_key(key)
|
||||||
return True
|
return True
|
||||||
|
|||||||
Reference in New Issue
Block a user