(self, file_code: FileCodes)
| 382 | raise HTTPException(status_code=503, detail="服务代理下载异常,请稍后再试") |
| 383 | |
| 384 | async def get_file_url(self, file_code: FileCodes): |
| 385 | if file_code.prefix == "文本分享": |
| 386 | return file_code.text |
| 387 | if self.proxy: |
| 388 | return await get_file_url(file_code.code) |
| 389 | else: |
| 390 | async with self._client() as s3: |
| 391 | result = await s3.generate_presigned_url( |
| 392 | "get_object", |
| 393 | Params={ |
| 394 | "Bucket": self.bucket_name, |
| 395 | "Key": await file_code.get_file_path(), |
| 396 | }, |
| 397 | ExpiresIn=3600, |
| 398 | ) |
| 399 | return result |
| 400 | |
| 401 | async def save_chunk(self, upload_id: str, chunk_index: int, chunk_data: bytes, chunk_hash: str, save_path: str): |
| 402 | """ |
no test coverage detected