fix: adjust alreadyUploadSize computation to prevent exceeding total file size

This commit is contained in:
keven1024
2025-07-02 10:38:59 +08:00
parent 695395ba6a
commit 668a2dd4d8

View File

@@ -27,7 +27,7 @@ const fileSliceUploadStatusList = ref<
>([])
const successCount = computed(() => fileSliceUploadStatusList.value.filter((item) => item.status === 'success').length)
const alreadyUploadSize = computed(() => successCount.value * chunkSize.value)
const alreadyUploadSize = computed(() => Math.min(successCount.value * chunkSize.value, props?.data?.file?.size))
const uploadProgress = computed(() => Math.round((alreadyUploadSize.value / (props?.data?.file?.size || 0)) * 100))
const { error } = useAsyncState(async () => {