feat(phase-4): AC-16/17/18 前端登录态与分片上传、后管包体与竞态门

AC-16(S1-F1/S1-F2)
- frontend-vue ensureAuth:清态前先判 isAuthError——弱网/超时/5xx 不再把人踢回登录页;
  http.ts 的 onResponseRejected 给错误打鉴权标记(HTTP 401 与业务 401/4011 都算),
  纯网络错误保留底层文案供调用方区分"断网"与"掉登录";clearLocalSession 导出复用。
- admin 全局错误兜底:main.ts 装 app.config.errorHandler(首屏就崩也接得住),
  window error / unhandledrejection 由 App.vue setup 调 useGlobalErrorReporting() 接线,
  卸载出口在 onBeforeUnmount 摘监听与提示定时器(后管的 timer-cleanup-pairing 尺子要求
  "注册点所在文件找得回反注册 + 卸载钩子",故接线必须在组件作用域,不在 main.ts)。
  上报体只带 kind/message/stack/route/ts 并过脱敏(Bearer、JWT 三段式、query 里疑似
  token/key/secret 的取值一律打码),凭据零容忍;服务端新增
  /api/admin/client-errors(requireAdmin,字段截断 2000 后 WARN 落日志,不落库)。

AC-17(S1-F3)
- 后端新增分片通道 ChunkedUploadService(init/part/status/complete/abort):8MB/片、
  同片重复上传幂等覆盖、流式拼装复算 sha256、超限与缺片直接拒绝、24h 过期回收;
  FileUploadController 暴露 /api/files/chunk/**,LocalFileStorageService 加
  saveTempFileFromFile(同一套扩展名黑名单与 fileKey 索引);三键显式写进 application.yml
  (不进"只在代码默认值里"的名单)。
- 工作台安装包 93MB:WorkbenchClientPackageService 走同一分片通道转存 client 桶
  (objectKey 写进会话 purpose,拼装时逐字匹配,防借分片接口覆盖已发布包),
  confirm 失败带 cleanupUnconfirmedObject 补偿清理未登记对象;后管 ≤64MB 仍直传预签名 PUT。
- 用户端 upload.ts:大文件分片 + 逐片重试 + 进度回调,超时按体积给(不再固定 120s);
  断点探测失败不再静默按"全缺"重传(catch-silence 棘轮因此一格没涨,blocks 300→301 已记名)。

AC-18(P1-F1/P1-F2/P1-F4/S1-F4)
- 后管 manualChunks 摘掉 element-plus(按需引入已在 src/plugins/element.ts 生效):
  实测构建产物已无 element-plus 独立 chunk,index.html 只 modulepreload vue 块。
- UsersPage/DeviceLogsPage 接 createLatestRequestGate,旧响应不再覆盖新页;
  用户端新增 useServerTablePaging(只驻留当前页 + 自带竞态门 + 失败给原因),
  挂载用例 3 例钉住"翻页重取/旧响应作废/失败可见"。
- DeliveryVideoWorkspace 两处轮询接 document.visibilityState,隐藏标签页暂停。

激活 Phase 0 预置契约 7 例(用户端 5 + 后管 5,共 12 例;其中 AC-16 后管两支按"接线在组件作用域"
的口径改写并把判据加强到反注册配对 + 根组件接线,见蓝图 §5)。
门禁读数:后端 mvn -o test-compile rc=0,CatchSilenceRatchetTest 9 例绿(total 1034→1045、
notRethrow 585→591、logOnly 182→188 逐处记名,EMPTY 未涨)、ChunkedUploadServiceTest 8 例、
WorkbenchClientPackageServiceTest 21 例、ClientErrorReportControllerTest 4 例;后管 1848 例 +
mount 33 例 + vue-tsc + build 全绿;用户端 955 例 + mount 30 例 + vue-tsc + build 全绿。
真机:OssWorkbenchClientLiveVerificationTest 以线上 MinIO 实测 PUT→stat→sha256→presign→删除
全链 1 例绿(凭据只走环境变量,不落任何文件)。

⚠ 按 pathspec 只圈本轮文件:application.yml 用索引手术只提交分片三键那一格,他人
「PENDING 不再按 2 小时判死」的 StaleTaskRepairService/ClientTaskPullSpi/application.yml
注释件与 useLiveTaskBoard/BrandAppearancePatentTab/task-delete-target 四件在飞改动
原样留在工作树未提交。
This commit is contained in:
2026-10-29 13:47:21 +08:00
parent 62a1b50067
commit 0586df2df0
31 changed files with 1798 additions and 64 deletions
@@ -3,6 +3,7 @@ package com.nanri.aiimage.modules.file.controller;
import com.nanri.aiimage.common.api.ApiResponse;
import com.nanri.aiimage.modules.file.model.vo.ExcelInfoVo;
import com.nanri.aiimage.modules.file.model.vo.UploadFileVo;
import com.nanri.aiimage.modules.file.service.ChunkedUploadService;
import com.nanri.aiimage.modules.file.service.LocalFileStorageService;
import com.nanri.aiimage.modules.file.service.oss.OssStorageService;
import io.swagger.v3.oas.annotations.Operation;
@@ -13,14 +14,20 @@ import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.responses.ApiResponses;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RequestPart;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import java.io.File;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
@RestController
@RequiredArgsConstructor
@@ -30,6 +37,7 @@ public class FileUploadController {
private final LocalFileStorageService localFileStorageService;
private final OssStorageService ossStorageService;
private final ChunkedUploadService chunkedUploadService;
@PostMapping("/upload")
@Operation(
@@ -72,6 +80,92 @@ public class FileUploadController {
return ApiResponse.success(vo);
}
@PostMapping("/chunk/init")
@Operation(
summary = "初始化分片上传",
description = """
大文件分片上传的第一步:登记文件大小与分片数,返回 uploadId。
分片逐个 POST 到 /chunk/{uploadId}/part/{index},全部到齐后调
/chunk/{uploadId}/complete 拼装为普通临时文件(同一套 fileKey 语义)。
每片可独立重试,前端也可先查 /chunk/{uploadId} 拿到已到片号续传。
""")
public ApiResponse<Map<String, Object>> initChunkUpload(
@RequestParam String fileName,
@RequestParam int totalParts,
@RequestParam long totalBytes) {
ChunkedUploadService.ChunkSession session =
chunkedUploadService.init(fileName, totalParts, totalBytes, "");
Map<String, Object> result = new LinkedHashMap<>();
result.put("upload_id", session.uploadId());
result.put("total_parts", session.totalParts());
return ApiResponse.success(result);
}
@PostMapping("/chunk/{uploadId}/part/{index}")
@Operation(summary = "上传一个分片", description = "同一片重复上传按覆盖处理(重试/续传幂等)。")
public ApiResponse<Map<String, Object>> uploadChunk(
@PathVariable String uploadId,
@PathVariable int index,
@RequestPart("file") MultipartFile file) throws Exception {
int received = chunkedUploadService.savePart(uploadId, index, file);
Map<String, Object> result = new LinkedHashMap<>();
result.put("upload_id", uploadId);
result.put("received_parts", received);
return ApiResponse.success(result);
}
@GetMapping("/chunk/{uploadId}")
@Operation(summary = "查询已上传分片", description = "返回已到齐的分片序号,供断点续传跳过已传片。")
public ApiResponse<Map<String, Object>> chunkStatus(@PathVariable String uploadId) {
List<Integer> parts = chunkedUploadService.uploadedParts(uploadId);
Map<String, Object> result = new LinkedHashMap<>();
result.put("upload_id", uploadId);
result.put("uploaded_parts", parts);
return ApiResponse.success(result);
}
@PostMapping("/chunk/{uploadId}/complete")
@Operation(
summary = "拼装分片并落盘",
description = """
全部分片到齐后流式拼装并复算 sha256,落盘为普通临时文件(返回 fileKey)。
uploadToOss=true 时与 /upload 同一出口:拼装后转存公开 OSS。
缺少任一分片直接拒绝,不会产出半个文件。
""")
public ApiResponse<UploadFileVo> completeChunkUpload(
@PathVariable String uploadId,
@RequestParam(required = false) String relativePath,
@RequestParam(defaultValue = "false") boolean uploadToOss,
@RequestParam(defaultValue = "COMMON") String moduleType) throws Exception {
ChunkedUploadService.CompletedUpload completed = chunkedUploadService.complete(uploadId);
try {
UploadFileVo vo = localFileStorageService.saveTempFileFromFile(
completed.file().toFile(), completed.fileName(), relativePath, completed.size());
if (uploadToOss) {
File localFile = new File(vo.getLocalPath());
OssStorageService.UploadedResult uploaded =
ossStorageService.uploadPublicFileWithFreshDownloadUrl(
localFile, moduleType, vo.getOriginalFilename());
vo.setObjectKey(uploaded.objectKey());
vo.setUrl(uploaded.downloadUrl());
vo.setMediaType(resolveMediaType(null, vo.getOriginalFilename()));
}
return ApiResponse.success(vo);
} finally {
completed.file().toFile().delete();
}
}
@DeleteMapping("/chunk/{uploadId}")
@Operation(summary = "放弃分片上传", description = "删除未完成的会话与已落盘分片。")
public ApiResponse<Map<String, Object>> abortChunkUpload(@PathVariable String uploadId) {
chunkedUploadService.abort(uploadId);
Map<String, Object> result = new LinkedHashMap<>();
result.put("upload_id", uploadId);
result.put("aborted", true);
return ApiResponse.success(result);
}
@GetMapping("/excel-info")
@Operation(summary = "读取 Excel 信息", description = "根据 fileKey 读取 Excel 第一行表头及总行数,供前端选择保留列和展示总条数。")
@ApiResponses({
@@ -0,0 +1,342 @@
package com.nanri.aiimage.modules.file.service;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.ObjectNode;
import com.nanri.aiimage.common.exception.BusinessException;
import com.nanri.aiimage.config.StorageProperties;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.StandardCopyOption;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.time.Instant;
import java.util.ArrayList;
import java.util.HexFormat;
import java.util.List;
import java.util.UUID;
import java.util.concurrent.ConcurrentHashMap;
import java.util.regex.Pattern;
import java.util.stream.Stream;
/**
* 临时文件分片上传(S1-F3/AC-17):把大文件拆成固定大小的分片逐个落盘,全部到齐后
* 在服务端流式拼装并复算 sha256。
*
* <p>存在的理由:单次 multipart/单次预签名 PUT 在弱网下一断就从 0 重传,93MB 级安装包
* 与视频几乎没有一次成功的运气。分片后每一片都可独立重试,前端还能查询已到片号续传。</p>
*
* <p>落盘位置在 {@code local-temp-dir/chunk-uploads/},不进入业务结果目录;超过
* {@code stale-hours} 未完成的分片会话在下次 init 时顺手清理。uploadId 只接受 32 位
* 十六进制(自己生成、自己校验),分片序号只接受整数,用户文件名只进 meta 展示,
* 不参与任何路径拼接。</p>
*/
@Service
@RequiredArgsConstructor
@Slf4j
public class ChunkedUploadService {
private static final Pattern UPLOAD_ID_PATTERN = Pattern.compile("[0-9a-f]{32}");
private static final ObjectMapper JSON = new ObjectMapper();
private static final String META_NAME = "meta.json";
/** 单个分片上限:比前端 16MB 分片留足余量,防一次请求把临时盘打满。 */
private static final long MAX_PART_BYTES = 64L * 1024 * 1024;
private final StorageProperties storageProperties;
/** 同一会话的落片/拼装/放弃串行化;会话结束即回收,避免长期驻留。 */
private final ConcurrentHashMap<String, Object> sessionLocks = new ConcurrentHashMap<>();
@Value("${aiimage.file.chunk-upload.max-total-bytes:2147483648}")
private long maxTotalBytes = 2L * 1024 * 1024 * 1024;
@Value("${aiimage.file.chunk-upload.max-parts:4096}")
private int maxParts = 4096;
@Value("${aiimage.file.chunk-upload.stale-hours:24}")
private long staleHours = 24;
/** 分片会话句柄:uploadId 与总片数。 */
public record ChunkSession(String uploadId, int totalParts) {
}
/** 拼装完成的临时文件;调用方负责删除。 */
public record CompletedUpload(Path file, String fileName, long size, String sha256) {
}
public ChunkSession init(String fileName, int totalParts, long totalBytes, String purpose) {
String safeName = normalizeFileName(fileName);
if (totalParts < 1 || totalParts > maxParts) {
throw new BusinessException("分片数量非法(1-" + maxParts + ")");
}
if (totalBytes < 1 || totalBytes > maxTotalBytes) {
throw new BusinessException("文件大小超出上限(最大 " + maxTotalBytes + " 字节)");
}
cleanupStaleSessions();
String uploadId = UUID.randomUUID().toString().replace("-", "");
Path dir = sessionDir(uploadId);
try {
Files.createDirectories(dir);
ObjectNode meta = JSON.createObjectNode();
meta.put("fileName", safeName);
meta.put("totalParts", totalParts);
meta.put("totalBytes", totalBytes);
meta.put("purpose", purpose == null ? "" : purpose);
meta.put("createdAt", Instant.now().toEpochMilli());
JSON.writeValue(metaFile(uploadId).toFile(), meta);
} catch (IOException ex) {
deleteQuietly(dir);
throw new BusinessException("初始化分片上传失败:" + ex.getMessage());
}
log.info("[chunk-upload] 初始化分片会话 uploadId={} fileName={} parts={} bytes={}",
uploadId, safeName, totalParts, totalBytes);
return new ChunkSession(uploadId, totalParts);
}
/**
* 落一片。同一片重复上传按覆盖处理(幂等):前端重试/续传时不必先查状态。
* 返回当前已到齐的片数,供前端做进度展示。
*/
public int savePart(String uploadId, int index, MultipartFile part) throws IOException {
Meta meta = readMeta(uploadId);
if (index < 0 || index >= meta.totalParts) {
throw new BusinessException("分片序号越界:" + index);
}
if (part == null || part.isEmpty()) {
throw new BusinessException("分片内容为空");
}
if (part.getSize() > MAX_PART_BYTES) {
throw new BusinessException("单个分片超过上限:" + part.getSize());
}
synchronized (lockOf(uploadId)) {
Path dir = sessionDir(uploadId);
Path target = dir.resolve("part-" + index);
Path tmp = dir.resolve("part-" + index + ".tmp");
try (InputStream in = part.getInputStream()) {
Files.copy(in, tmp, StandardCopyOption.REPLACE_EXISTING);
}
Files.move(tmp, target, StandardCopyOption.REPLACE_EXISTING);
long total = currentTotalBytes(uploadId, meta.totalParts);
if (total > maxTotalBytes) {
deleteQuietly(target);
throw new BusinessException("分片累计超过文件上限(最大 " + maxTotalBytes + " 字节)");
}
if (total > meta.totalBytes) {
deleteQuietly(target);
throw new BusinessException("分片累计超过声明的文件大小:" + meta.totalBytes);
}
return (int) uploadedPartIndexes(uploadId, meta.totalParts).size();
}
}
public List<Integer> uploadedParts(String uploadId) {
Meta meta = readMeta(uploadId);
return uploadedPartIndexes(uploadId, meta.totalParts);
}
/**
* 全部片到齐后流式拼装并复算 sha256;拼装完成的文件落在 chunk-uploads 根下,
* 会话目录随之清掉。缺少分片直接拒绝,绝不拼出半个文件。
*/
public CompletedUpload complete(String uploadId) throws IOException {
Meta meta = readMeta(uploadId);
synchronized (lockOf(uploadId)) {
List<Integer> present = uploadedPartIndexes(uploadId, meta.totalParts);
if (present.size() != meta.totalParts) {
List<Integer> missing = new ArrayList<>();
for (int i = 0; i < meta.totalParts; i++) {
if (!present.contains(i)) {
missing.add(i);
if (missing.size() >= 20) {
break;
}
}
}
throw new BusinessException("分片不完整,缺少 " + missing);
}
Path assembled = chunkRoot().resolve("assembled-" + uploadId + ".bin");
MessageDigest digest = sha256Digest();
long total = 0;
try (OutputStream out = Files.newOutputStream(assembled)) {
byte[] buffer = new byte[1 << 20];
for (int i = 0; i < meta.totalParts; i++) {
Path part = sessionDir(uploadId).resolve("part-" + i);
try (InputStream in = Files.newInputStream(part)) {
int read;
while ((read = in.read(buffer)) > 0) {
out.write(buffer, 0, read);
digest.update(buffer, 0, read);
total += read;
}
}
}
} catch (IOException ex) {
Files.deleteIfExists(assembled);
throw ex;
}
if (total != meta.totalBytes) {
Files.deleteIfExists(assembled);
throw new BusinessException(
"拼装后大小与声明不一致:声明 " + meta.totalBytes + ",实际 " + total);
}
deleteQuietly(sessionDir(uploadId));
sessionLocks.remove(uploadId);
String sha256 = HexFormat.of().formatHex(digest.digest());
log.info("[chunk-upload] 拼装完成 uploadId={} fileName={} bytes={} sha256={}",
uploadId, meta.fileName, total, sha256);
return new CompletedUpload(assembled, meta.fileName, total, sha256);
}
}
/** 放弃本次分片会话(前端取消/确认失败清理)。 */
public void abort(String uploadId) {
Meta meta = readMeta(uploadId);
synchronized (lockOf(uploadId)) {
deleteQuietly(sessionDir(uploadId));
}
sessionLocks.remove(uploadId);
log.info("[chunk-upload] 已放弃分片会话 uploadId={} fileName={}", uploadId, meta.fileName);
}
/** 分片会话随附的业务标识(工作台包用它钉住 objectKey,防拼装时换 key)。 */
public String purposeOf(String uploadId) {
return readMeta(uploadId).purpose;
}
private Meta readMeta(String uploadId) {
if (uploadId == null || !UPLOAD_ID_PATTERN.matcher(uploadId).matches()) {
throw new BusinessException("分片会话不存在或已过期");
}
Path metaFile = metaFile(uploadId);
if (!Files.isRegularFile(metaFile)) {
throw new BusinessException("分片会话不存在或已过期");
}
try {
JsonNode node = JSON.readTree(metaFile.toFile());
return new Meta(node.path("fileName").asText(""),
node.path("totalParts").asInt(0),
node.path("totalBytes").asLong(0),
node.path("purpose").asText(""));
} catch (IOException ex) {
throw new BusinessException("分片会话元数据损坏,请重新上传");
}
}
private List<Integer> uploadedPartIndexes(String uploadId, int totalParts) {
List<Integer> result = new ArrayList<>();
for (int i = 0; i < totalParts; i++) {
if (Files.isRegularFile(sessionDir(uploadId).resolve("part-" + i))) {
result.add(i);
}
}
return result;
}
private long currentTotalBytes(String uploadId, int totalParts) throws IOException {
long total = 0;
for (int i = 0; i < totalParts; i++) {
Path part = sessionDir(uploadId).resolve("part-" + i);
if (Files.isRegularFile(part)) {
total += Files.size(part);
}
}
return total;
}
private Path chunkRoot() {
return Path.of(storageProperties.getLocalTempDir()).resolve("chunk-uploads").normalize();
}
private Path sessionDir(String uploadId) {
if (uploadId == null || !UPLOAD_ID_PATTERN.matcher(uploadId).matches()) {
throw new BusinessException("分片会话不存在或已过期");
}
return chunkRoot().resolve(uploadId);
}
private Path metaFile(String uploadId) {
return sessionDir(uploadId).resolve(META_NAME);
}
private Object lockOf(String uploadId) {
return sessionLocks.computeIfAbsent(uploadId, key -> new Object());
}
private void cleanupStaleSessions() {
Path root = chunkRoot();
if (!Files.isDirectory(root)) {
return;
}
long cutoff = System.currentTimeMillis() - Math.max(1, staleHours) * 3600_000L;
try (Stream<Path> children = Files.list(root)) {
children.forEach(child -> {
try {
if (Files.getLastModifiedTime(child).toMillis() < cutoff) {
deleteQuietly(child);
log.info("[chunk-upload] 清理过期分片会话/残留文件 path={}", child.getFileName());
}
} catch (IOException ex) {
log.warn("[chunk-upload] 条目时间戳读不出,本轮跳过该条 path={}", child.getFileName());
}
});
} catch (IOException ex) {
log.warn("[chunk-upload] 扫描过期分片会话失败: {}", ex.getMessage());
}
}
private String normalizeFileName(String fileName) {
String name = fileName == null ? "" : fileName.trim();
if (name.isEmpty()) {
throw new BusinessException("文件名不能为空");
}
if (name.length() > 255) {
name = name.substring(name.length() - 255);
}
return name.replace('\\', '/').replaceAll(".*/", "");
}
private MessageDigest sha256Digest() {
try {
return MessageDigest.getInstance("SHA-256");
} catch (NoSuchAlgorithmException ex) {
throw new IllegalStateException("SHA-256 not available", ex);
}
}
private void deleteQuietly(Path path) {
if (path == null) {
return;
}
try {
if (Files.isDirectory(path)) {
try (Stream<Path> walk = Files.walk(path)) {
walk.sorted((a, b) -> b.getNameCount() - a.getNameCount())
.forEach(p -> {
try {
Files.deleteIfExists(p);
} catch (IOException ex) {
log.warn("[chunk-upload] 残留片删除失败,留给下一轮清理 path={}", p);
}
});
}
} else {
Files.deleteIfExists(path);
}
} catch (IOException ex) {
log.warn("[chunk-upload] 清理未竟,残留交给过期回收 path={}", path);
}
}
private record Meta(String fileName, int totalParts, long totalBytes, String purpose) {
}
}
@@ -78,6 +78,35 @@ public class LocalFileStorageService {
return vo;
}
/**
* 分片拼装后的落盘(AC-17):与 {@link #saveTempFile} 同一套扩展名闸门与 fileKey 索引,
* 只是源从 MultipartFile 换成服务端已拼好的临时文件。
*/
public UploadFileVo saveTempFileFromFile(File source, String originalFilename,
String relativePath, long declaredSize) throws IOException {
File tempDir = FileUtil.file(storageProperties.getLocalTempDir());
File parentDir = tempDir.getParentFile();
if (parentDir != null) {
FileUtil.mkdir(parentDir);
}
FileUtil.mkdir(tempDir);
String fileKey = IdUtil.fastSimpleUUID();
String extName = FileUtil.extName(originalFilename);
rejectBlockedExtension(originalFilename, extName);
String filename = fileKey + (extName.isEmpty() ? "" : "." + extName);
File target = FileUtil.file(tempDir, filename);
FileUtil.move(source, target, true);
registerSourceFileIndex(fileKey, filename);
UploadFileVo vo = new UploadFileVo();
vo.setFileKey(fileKey);
vo.setOriginalFilename(originalFilename);
vo.setLocalPath(target.getAbsolutePath());
vo.setSize(target.length() > 0 ? target.length() : Math.max(0, declaredSize));
vo.setRelativePath(relativePath);
return vo;
}
/** 扩展名黑名单校验:命中即拒绝落盘(大小写不敏感)。 */
private void rejectBlockedExtension(String originalFilename, String extName) {
if (extName == null || extName.isBlank()) {
@@ -322,6 +322,17 @@ public class OssStorageService {
return presignPublicClientUpload(objectKey, WORKBENCH_CLIENT_PREFIX, "workbench client", expirySeconds);
}
/**
* 服务端直传工作台客户端包(AC-17 分片通道的落点):浏览器分片 → 后端拼装 → 这里
* 上传到公开 client 桶的 {@code workbench-client/versions/} 前缀。
* 与直传预签名写的是同一个桶/前缀,confirm 阶段的实物复算 sha256 与凭据扫描照旧生效。
*/
public String uploadWorkbenchClientObject(File file, String objectKey) {
requireWorkbenchClientKey(objectKey);
uploadFile(file, publicClientBucket(), objectKey);
return objectKey;
}
/** 返回工作台客户端包字节数;对象不存在返回 -1(直传确认时先卡大小,再算摘要)。 */
public long workbenchClientObjectSize(String objectKey) {
return publicClientObjectSize(objectKey, WORKBENCH_CLIENT_PREFIX, "workbench client");