fix(api): let authors and owners delete unfinished uploads

This commit is contained in:
justme committed 2026-10-16 19:42:33 +08:00
1 parent 1dd54243ae
commit 82d55a97f9
2 files changed
+19 -1

No files matched your search

+3 -1
View File
@@ -515,7 +515,9 @@ public sealed partial class ChannelService(
var crypto = tx.GetWorkspaceCrypto(id);
var obj = crypto.Objects.Find(o => o.ItemId == itemId.ToBase64Url());
if (creds.RequireSignedContent && obj is not null)
// 没传完的上传(末帧从未入库)没有已验签的清单,也就不可能有删除事件:作者或空间主可以直接清理,否则它会永久占着空间配额
bool unfinished = obj is not null && obj.Event is null;
if (creds.RequireSignedContent && obj is not null && !unfinished)
{
if (signedEvent is null || obj?.Event is null || signedEvent.Username != principal.AccountName
|| signedEvent.DeviceId != creds.AccountDeviceId || signedEvent.ChannelId != obj.ChannelId