(
purpose: str,
file_id: str,
ext: str,
tenant_id: str,
original_name: Optional[str] = None,
)
| 38 | |
| 39 | |
| 40 | def _object_key( |
| 41 | purpose: str, |
| 42 | file_id: str, |
| 43 | ext: str, |
| 44 | tenant_id: str, |
| 45 | original_name: Optional[str] = None, |
| 46 | ) -> str: |
| 47 | type_path = "imgs/" if (ext in image_extensions) else "files/" |
| 48 | purpose_path = f"{purpose[0]}/" |
| 49 | tenant_path = f"{tenant_id}/" |
| 50 | date_path = f"{get_base62_date()}/" |
| 51 | ext = f"/{original_name}" if original_name else f".{ext}" |
| 52 | |
| 53 | return f"{type_path}{purpose_path}{tenant_path}{date_path}{file_id}{ext}" |
| 54 | |
| 55 | |
| 56 | class StorageClient: |
no test coverage detected