feat: enhance download URL generation with optional filename parameter

Added support for an optional `download_filename` parameter in the `get_download_url` and `get_download_urls` methods across various storage classes. This allows users to specify a custom filename for downloads, improving user experience by enabling better file naming during downloads. Updated related methods and tests to accommodate this new functionality.
This commit is contained in:
Harry
2026-02-03 14:40:14 +08:00
parent 5441b9c3ad
commit 49befa6d3f
10 changed files with 240 additions and 63 deletions

View File

@ -32,10 +32,22 @@ class DummyStorage(BaseStorage):
def delete(self, filename: str):
return None
def get_download_url(self, filename: str, expires_in: int = 3600) -> str:
def get_download_url(
self,
filename: str,
expires_in: int = 3600,
*,
download_filename: str | None = None,
) -> str:
raise NotImplementedError
def get_download_urls(self, filenames: list[str], expires_in: int = 3600) -> list[str]:
def get_download_urls(
self,
filenames: list[str],
expires_in: int = 3600,
*,
download_filenames: list[str] | None = None,
) -> list[str]:
raise NotImplementedError
def get_upload_url(self, filename: str, expires_in: int = 3600) -> str: