P0-B: 数据损坏修复
- v1 上传大小校验: multipart body 长度与文件字节数不应相等,改为上限校验(上传功能恢复) - mirror_sync 调度循环/remove_sync_source 死锁修复(锁外触发 start/stop) - HTTP 断点续传损坏修复: 续传时先复制已有前缀再追加尾部,服务器忽略 Range 时从头重下 - sync_engine 同款续传 bug 同步修复;temp_path 提前初始化避免 except NameError
This commit is contained in:
@@ -1015,7 +1015,9 @@ class APIv1:
|
||||
total_written += len(chunk)
|
||||
file_size = total_written
|
||||
|
||||
if content_length > 0 and file_size != content_length:
|
||||
# content_length 是整个 multipart body 的长度(含 boundary/字段头),
|
||||
# 文件字节数不可能等于它;这里只做上限校验防止越界读取
|
||||
if content_length > 0 and file_size > content_length:
|
||||
raise IOError(f"文件大小不匹配。期望: {content_length}, 实际: {file_size}")
|
||||
|
||||
if os.path.exists(full_path):
|
||||
|
||||
Reference in New Issue
Block a user