chore: 文件大小限制调整为20MB

This commit is contained in:
thzxx
2026-05-18 17:36:41 +08:00
parent 21d7b2da9f
commit c773a0d8e6
2 changed files with 5 additions and 5 deletions
+3 -3
View File
@@ -660,7 +660,7 @@
}
// ===== File Size Limit =====
const MAX_FILE_SIZE = 10 * 1024 * 1024; // 10MB
const MAX_FILE_SIZE = 20 * 1024 * 1024; // 20MB
function formatFileSize(bytes) {
if (bytes < 1024) return bytes + ' B';
@@ -685,7 +685,7 @@
const ext = file.name.substring(file.name.lastIndexOf('.')).toLowerCase();
if (!['.md', '.markdown', '.txt'].includes(ext)) return;
if (file.size > MAX_FILE_SIZE) {
alert(`"${file.name}" 过大(${formatFileSize(file.size)}),暂不支持超过 10MB 的文件`);
alert(`"${file.name}" 过大(${formatFileSize(file.size)}),暂不支持超过 20MB 的文件`);
return;
}
const reader = new FileReader();
@@ -850,7 +850,7 @@
if (!allowedExts.includes(ext)) continue;
// Electron 主进程已有文件大小检查,此处为浏览器模式兜底
if (file.size > MAX_FILE_SIZE) {
alert(`"${file.name}" 过大(${formatFileSize(file.size)}),暂不支持超过 10MB 的文件`);
alert(`"${file.name}" 过大(${formatFileSize(file.size)}),暂不支持超过 20MB 的文件`);
continue;
}
if (filePath && typeof window.electronAPI !== 'undefined') {