@@ -521,7 +521,14 @@ async def rm(
521521 expand_path = expand_path ,
522522 )
523523
524- def make_sas_link (self , filepath , expiry = None , write = False ):
524+ def make_sas_link (
525+ self ,
526+ filepath : str ,
527+ expiry : datetime | None = None ,
528+ * ,
529+ write : bool = False ,
530+ content_disposition_filename : str | None = None ,
531+ ):
525532 account_dict = {
526533 x .split ("=" , 1 )[0 ]: x .split ("=" , 1 )[1 ]
527534 for x in self .connection_string .split (";" )
@@ -532,13 +539,20 @@ def make_sas_link(self, filepath, expiry=None, write=False):
532539 expiry = datetime (2050 , 1 , 1 , tzinfo = timezone .utc )
533540 if isinstance (expiry , str ):
534541 expiry = datetime .fromisoformat (expiry )
542+ if content_disposition_filename is None :
543+ content_disposition = None
544+ else :
545+ content_disposition = (
546+ f'attachment; filename="{ content_disposition_filename } "'
547+ )
535548 sas = asb .generate_blob_sas (
536549 account_name = account_dict ["AccountName" ],
537550 account_key = account_dict ["AccountKey" ],
538551 container_name = filepath .split ("/" , 1 )[0 ],
539552 blob_name = filepath .split ("/" , 1 )[1 ],
540553 permission = asb .BlobSasPermissions (read = True , write = write ),
541554 expiry = expiry ,
555+ content_disposition = content_disposition ,
542556 )
543557 return f"https://{ account_dict ['AccountName' ]} .blob.core.windows.net/{ filepath } ?{ sas } "
544558
0 commit comments