From dd905c5c90f06f28c151b1557bf3e3df050e7921 Mon Sep 17 00:00:00 2001 From: Orion Date: Fri, 18 Sep 2026 16:22:22 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix(webdav):=20=E4=BF=9D?= =?UTF-8?q?=E8=AF=81=E6=B5=81=E5=BC=8F=E4=B8=8A=E4=BC=A0=E5=8F=96=E6=B6=88?= =?UTF-8?q?=E5=90=8E=E6=B8=85=E7=90=86=E6=9C=AA=E5=8F=91=E5=B8=83=E6=96=87?= =?UTF-8?q?=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- FRONTEND_2026_REVISION | 2 +- core/webdav_stream.py | 9 +-------- tests/test_webdav_stream_upload.py | 7 +++++++ 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/FRONTEND_2026_REVISION b/FRONTEND_2026_REVISION index 2f79ff6..6560902 100644 --- a/FRONTEND_2026_REVISION +++ b/FRONTEND_2026_REVISION @@ -1 +1 @@ -f2461378ef9a103e72d3f8ed6ea4ef6fdaecb32c +a962f7aec7c222b1545ecb3774e95d534b1219e9 diff --git a/core/webdav_stream.py b/core/webdav_stream.py index 355793c..52aa955 100644 --- a/core/webdav_stream.py +++ b/core/webdav_stream.py @@ -92,11 +92,4 @@ class WebDAVStreamMixin: return save_path,digest async def clean_stream_upload(self, upload_id, save_path): - info = await self._stream_session(upload_id) - if info is None: - return - directory = str(PurePosixPath(self._stream_part_path(info, 0)).parent) - async with aiohttp.ClientSession(auth=self.auth, timeout=OFFSET_TIMEOUT) as client: - async with client.delete(self._build_url(directory)) as response: - if response.status not in (200, 204, 404): - raise HTTPException(503, 'WebDAV 分片清理失败,请重试') + await self.clean_offset_upload(upload_id, save_path) diff --git a/tests/test_webdav_stream_upload.py b/tests/test_webdav_stream_upload.py index c8e4bb3..779ada0 100644 --- a/tests/test_webdav_stream_upload.py +++ b/tests/test_webdav_stream_upload.py @@ -41,3 +41,10 @@ class WebDAVStreamTests(WebDAVFixture): await UploadChunk.filter(upload_id=uid,chunk_index=0).delete() self.assertEqual((await self.chunk(uid,0)).status_code,200) self.assertFalse(any(c[0]=='PATCH' for c in self.calls)) + + async def test_cancel_after_lost_move_reply_cleans_unpublished_destination(self): + uid=await self.upload_all();self.fail_move_reply=True + response=await self.complete(uid);self.assertEqual(response.status_code,503) + self.assertIn(self.payload,self.files.values()) + cancel=await self.client.delete(f'/chunk/upload/{uid}') + self.assertEqual(cancel.status_code,200);self.assertFalse(self.files)