同步上传合并后的文件
(self, save_path: str, data: bytes)
| 762 | return file_obj.get_content().execute_query().value |
| 763 | |
| 764 | def _upload_merged(self, save_path: str, data: bytes): |
| 765 | """同步上传合并后的文件""" |
| 766 | path_parts = save_path.replace("\\", "/").split("/") |
| 767 | filename = path_parts[-1] |
| 768 | dir_path = "/".join(path_parts[:-1]) |
| 769 | |
| 770 | # 确保目录存在 |
| 771 | current_folder = self.root_path |
| 772 | for part in dir_path.split("/"): |
| 773 | if part: |
| 774 | try: |
| 775 | current_folder = current_folder.get_by_path(part).get().execute_query() |
| 776 | except self._ClientRequestException as e: |
| 777 | if e.code == "itemNotFound": |
| 778 | current_folder = current_folder.create_folder(part).execute_query() |
| 779 | else: |
| 780 | raise e |
| 781 | |
| 782 | current_folder.upload(filename, data).execute_query() |
| 783 | |
| 784 | async def merge_chunks(self, upload_id: str, chunk_info: UploadChunk, save_path: str) -> tuple[str, str]: |
| 785 | """合并 OneDrive 上的分片文件,使用临时文件避免内存问题""" |
nothing calls this directly
no outgoing calls
no test coverage detected