mirror of https://github.com/zulip/zulip.git
upload: Use get_public_upload_url for export tarballs too.
This deduplicates the code so that we now just have one function for constructing S3 URLs.
This commit is contained in:
parent
5a4aecfc40
commit
9f2daeee45
|
@ -679,22 +679,7 @@ class S3UploadBackend(ZulipUploadBackend):
|
||||||
|
|
||||||
key.upload_file(tarball_path, Callback=percent_callback)
|
key.upload_file(tarball_path, Callback=percent_callback)
|
||||||
|
|
||||||
session = botocore.session.get_session()
|
public_url = self.get_public_upload_url(key.key)
|
||||||
config = Config(signature_version=botocore.UNSIGNED)
|
|
||||||
|
|
||||||
public_url = session.create_client(
|
|
||||||
"s3",
|
|
||||||
region_name=settings.S3_REGION,
|
|
||||||
endpoint_url=settings.S3_ENDPOINT_URL,
|
|
||||||
config=config,
|
|
||||||
).generate_presigned_url(
|
|
||||||
"get_object",
|
|
||||||
Params={
|
|
||||||
"Bucket": self.avatar_bucket.name,
|
|
||||||
"Key": key.key,
|
|
||||||
},
|
|
||||||
ExpiresIn=0,
|
|
||||||
)
|
|
||||||
return public_url
|
return public_url
|
||||||
|
|
||||||
def delete_export_tarball(self, export_path: str) -> Optional[str]:
|
def delete_export_tarball(self, export_path: str) -> Optional[str]:
|
||||||
|
|
Loading…
Reference in New Issue