同步保存分片到 OneDrive
(self, chunk_path: str, chunk_data: bytes)
| 730 | ) |
| 731 | |
| 732 | def _save_chunk(self, chunk_path: str, chunk_data: bytes): |
| 733 | """同步保存分片到 OneDrive""" |
| 734 | path_parts = chunk_path.replace("\\", "/").split("/") |
| 735 | filename = path_parts[-1] |
| 736 | dir_path = "/".join(path_parts[:-1]) |
| 737 | |
| 738 | # 确保目录存在 |
| 739 | current_folder = self.root_path |
| 740 | for part in dir_path.split("/"): |
| 741 | if part: |
| 742 | try: |
| 743 | current_folder = current_folder.get_by_path(part).get().execute_query() |
| 744 | except self._ClientRequestException as e: |
| 745 | if e.code == "itemNotFound": |
| 746 | current_folder = current_folder.create_folder(part).execute_query() |
| 747 | else: |
| 748 | raise e |
| 749 | |
| 750 | # 上传分片 |
| 751 | current_folder.upload(filename, chunk_data).execute_query() |
| 752 | |
| 753 | async def save_chunk(self, upload_id: str, chunk_index: int, chunk_data: bytes, chunk_hash: str, save_path: str): |
| 754 | """保存分片到 OneDrive""" |
nothing calls this directly
no outgoing calls
no test coverage detected