🐛 fix: 上传前拦截空文件并明确提示

* 普通选择和拖拽均拒绝零字节文件,清空无效选择及文件哈希
* 提交时复核单文件和打包结果,阻止分片或预签名初始化空文件
* 补充空文件入口及非空上传回归,记录生产分片代理限制修复
This commit is contained in:
orion committed 2026-10-06 00:52:12 +08:00
1 parent f2e78986bc
commit f7bae99fe4
4 files changed
+69 -3

No files matched your search

+6
View File
@@ -87,6 +87,12 @@ export function useSendFlow() {
}
const checkFileSize = (file: File) => {
if (file.size === 0) {
alertStore.showAlert(t('send.messages.emptyFileError'), 'error')
selectedFile.value = null
fileHash.value = ''
return false
}
if (file.size > config.value.uploadSize) {
alertStore.showAlert(
t('send.messages.fileSizeExceeded', { size: getStorageUnit(config.value.uploadSize) }),
+2 -3
View File
@@ -111,9 +111,6 @@ export function useSendSubmit(options: UseSendSubmitOptions) {
if (selectedFiles.length > 0) {
options.notify('正在打包文件...', 'success')
fileToUpload = await packFilesAsZip(selectedFiles)
if (!validateFileSize(fileToUpload)) {
return null
}
options.onHashCalculated(await calculateFileHash(fileToUpload))
}
@@ -121,6 +118,8 @@ export function useSendSubmit(options: UseSendSubmitOptions) {
throw new Error(options.translate('send.messages.selectFile'))
}
if (!validateFileSize(fileToUpload)) return null
operation.check()
options.onProgress({ loaded:0,total:fileToUpload.size,percentage:0 })
const result = await (enableChunk