修改上传限制

This commit is contained in:
2026-10-27 15:46:51 +08:00
parent a733a15959
commit c02faf30a7
2 changed files with 12 additions and 47 deletions
+8 -43
View File
@@ -153,6 +153,7 @@
"integrity": "sha512-RgHBCvtjbOK2gXSNBNIkNoEc9qoVEtau3hj8gEqKQuL3HZAibKarWFEI3Lfm6EYKkLalOh8eSrj9b+ch9H/VBA==",
"dev": true,
"license": "MIT",
"peer": true,
"dependencies": {
"@babel/code-frame": "^7.29.7",
"@babel/generator": "^7.29.7",
@@ -917,9 +918,6 @@
"x64"
],
"dev": true,
"libc": [
"glibc"
],
"license": "MIT",
"optional": true,
"os": [
@@ -1194,9 +1192,6 @@
"arm"
],
"dev": true,
"libc": [
"glibc"
],
"license": "MIT",
"optional": true,
"os": [
@@ -1211,9 +1206,6 @@
"arm"
],
"dev": true,
"libc": [
"musl"
],
"license": "MIT",
"optional": true,
"os": [
@@ -1228,9 +1220,6 @@
"arm64"
],
"dev": true,
"libc": [
"glibc"
],
"license": "MIT",
"optional": true,
"os": [
@@ -1245,9 +1234,6 @@
"arm64"
],
"dev": true,
"libc": [
"musl"
],
"license": "MIT",
"optional": true,
"os": [
@@ -1262,9 +1248,6 @@
"loong64"
],
"dev": true,
"libc": [
"glibc"
],
"license": "MIT",
"optional": true,
"os": [
@@ -1279,9 +1262,6 @@
"loong64"
],
"dev": true,
"libc": [
"musl"
],
"license": "MIT",
"optional": true,
"os": [
@@ -1296,9 +1276,6 @@
"ppc64"
],
"dev": true,
"libc": [
"glibc"
],
"license": "MIT",
"optional": true,
"os": [
@@ -1313,9 +1290,6 @@
"ppc64"
],
"dev": true,
"libc": [
"musl"
],
"license": "MIT",
"optional": true,
"os": [
@@ -1330,9 +1304,6 @@
"riscv64"
],
"dev": true,
"libc": [
"glibc"
],
"license": "MIT",
"optional": true,
"os": [
@@ -1347,9 +1318,6 @@
"riscv64"
],
"dev": true,
"libc": [
"musl"
],
"license": "MIT",
"optional": true,
"os": [
@@ -1364,9 +1332,6 @@
"s390x"
],
"dev": true,
"libc": [
"glibc"
],
"license": "MIT",
"optional": true,
"os": [
@@ -1381,9 +1346,6 @@
"x64"
],
"dev": true,
"libc": [
"glibc"
],
"license": "MIT",
"optional": true,
"os": [
@@ -1398,9 +1360,6 @@
"x64"
],
"dev": true,
"libc": [
"musl"
],
"license": "MIT",
"optional": true,
"os": [
@@ -1549,6 +1508,7 @@
"integrity": "sha512-qKgsUwfHZV2WCWLAnVP1JqnpE6Im6h3Y0+fYgMTasNQ7V++CBX5OT1as0g0f+OyubbFqhf6XVNIsmN4IIhEgGQ==",
"dev": true,
"license": "MIT",
"peer": true,
"dependencies": {
"undici-types": "~6.20.0"
}
@@ -1699,6 +1659,7 @@
}
],
"license": "MIT",
"peer": true,
"dependencies": {
"baseline-browser-mapping": "^2.11.29",
"caniuse-lite": "^1.0.30001816",
@@ -1772,7 +1733,8 @@
"version": "1.11.13",
"resolved": "https://registry.npmjs.org/dayjs/-/dayjs-1.11.13.tgz",
"integrity": "sha512-oaMBel6gjolK862uaPQOVTA7q3TZhuSvuMQAAglQDOWYO9A91IrAOUJEyKVlqJlHE0vq5p5UXxzdPfMH/x6xNg==",
"license": "MIT"
"license": "MIT",
"peer": true
},
"node_modules/debug": {
"version": "4.4.3",
@@ -2649,6 +2611,7 @@
"resolved": "https://registry.npmjs.org/react/-/react-18.3.1.tgz",
"integrity": "sha512-wS+hAgJShR0KhEvPJArfuPVN1+Hz1t0Y6n5jLrGQbkb4urgPE/0Rve+1kMB1v/oWgHgm4WIcV+i7F2pTVj+2iQ==",
"license": "MIT",
"peer": true,
"dependencies": {
"loose-envify": "^1.1.0"
},
@@ -2661,6 +2624,7 @@
"resolved": "https://registry.npmjs.org/react-dom/-/react-dom-18.3.1.tgz",
"integrity": "sha512-5m4nQKp+rZRb09LNH59GM4BxTh9251/ylbKIbpe7TpGxfJ+9kv6BLkLBXIjjspbgbnIBNqlI23tRnTWT0snUIw==",
"license": "MIT",
"peer": true,
"dependencies": {
"loose-envify": "^1.1.0",
"scheduler": "^0.23.2"
@@ -2892,6 +2856,7 @@
"integrity": "sha512-Cmuo5P0ENTN6HxLSo6IHsjCLn/81Vgrp81oaiFFMRa8gGDj5xEjIcEpf2ZymZtZR8oU0P2JX5WuUp/rlXcHkAw==",
"dev": true,
"license": "MIT",
"peer": true,
"dependencies": {
"esbuild": "^0.24.0",
"postcss": "^8.4.49",
+4 -4
View File
@@ -339,12 +339,12 @@ function UploadModal({
const isDir = files.some((f) => (f.file as File & { webkitRelativePath?: string }).webkitRelativePath);
const selected = isDir ? toSelected(files.map((f) => f.file), keepRoot) : files;
const total = selected.reduce((s, f) => s + f.file.size, 0);
const tooBig = selected.filter((f) => f.file.size > 10 * MiB);
const tooBig = selected.filter((f) => f.file.size > 50 * MiB);
const pathErrors = selected.map((f) => validatePath(joinPath(dir, f.relativePath))).filter(Boolean);
const problems = [
selected.length > 500 && '单次最多 500 个文件,请分批上传',
total > 50 * MiB && `合计 ${formatSize(total)},超过 50 MiB,请分批上传`,
tooBig.length > 0 && `${tooBig.length} 个文件超过单文件 10 MiB 限制:${tooBig.slice(0, 3).map((f) => f.relativePath).join('、')}`,
total > 200 * MiB && `合计 ${formatSize(total)},超过 200 MiB,请分批上传`,
tooBig.length > 0 && `${tooBig.length} 个文件超过单文件 50 MiB 限制:${tooBig.slice(0, 3).map((f) => f.relativePath).join('、')}`,
pathErrors.length > 0 && `存在非法路径:${pathErrors[0]}`,
].filter(Boolean) as string[];
@@ -385,7 +385,7 @@ function UploadModal({
{selected.map((f) => (
<div key={f.relativePath} className="mono" style={{ fontSize: 12, display: 'flex', justifyContent: 'space-between' }}>
<span>{joinPath(dir, f.relativePath)}</span>
<span style={{ color: f.file.size > 10 * MiB ? '#ff4d4f' : '#999' }}>{formatSize(f.file.size)}</span>
<span style={{ color: f.file.size > 50 * MiB ? '#ff4d4f' : '#999' }}>{formatSize(f.file.size)}</span>
</div>
))}
</div>