mirror of
https://github.com/KohakuBlueleaf/KohakuHub.git
synced 2026-03-09 07:12:07 -05:00
update document and unit of file size
This commit is contained in:
@@ -176,7 +176,7 @@ async function handleFileSelect(event) {
|
||||
}
|
||||
|
||||
// Validate file size (max 10MB)
|
||||
if (file.size > 10 * 1024 * 1024) {
|
||||
if (file.size > 10 * 1000 * 1000) {
|
||||
ElMessage.error("Image is too large. Maximum size is 10MB");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -133,7 +133,7 @@ const uploadData = computed(() => {
|
||||
});
|
||||
|
||||
function beforeUpload(file) {
|
||||
const maxSize = 100 * 1024 * 1024; // 100MB per file for regular upload
|
||||
const maxSize = 100 * 1000 * 1000; // 100MB per file for regular upload
|
||||
if (file.size > maxSize) {
|
||||
ElMessage.warning(
|
||||
`File ${file.name} is too large. Maximum size is 100MB per file.`,
|
||||
|
||||
@@ -277,7 +277,7 @@ const branch = computed(() => route.params.branch || "main");
|
||||
const filePath = computed(() => route.params.file || "");
|
||||
|
||||
// Constants
|
||||
const maxPreviewSize = 100 * 1024; // 100KB
|
||||
const maxPreviewSize = 100 * 1000; // 100KB
|
||||
|
||||
// State
|
||||
const loading = ref(true);
|
||||
@@ -497,11 +497,11 @@ function getFileIcon(filename) {
|
||||
|
||||
function formatSize(bytes) {
|
||||
if (!bytes || bytes === 0) return "0 B";
|
||||
if (bytes < 1024) return bytes + " B";
|
||||
if (bytes < 1024 * 1024) return (bytes / 1024).toFixed(1) + " KB";
|
||||
if (bytes < 1024 * 1024 * 1024)
|
||||
return (bytes / (1024 * 1024)).toFixed(1) + " MB";
|
||||
return (bytes / (1024 * 1024 * 1024)).toFixed(1) + " GB";
|
||||
if (bytes < 1000) return bytes + " B";
|
||||
if (bytes < 1000 * 1000) return (bytes / 1000).toFixed(1) + " KB";
|
||||
if (bytes < 1000 * 1000 * 1000)
|
||||
return (bytes / (1000 * 1000)).toFixed(1) + " MB";
|
||||
return (bytes / (1000 * 1000 * 1000)).toFixed(1) + " GB";
|
||||
}
|
||||
|
||||
async function loadFileInfo() {
|
||||
|
||||
@@ -138,9 +138,9 @@ export async function uploadLFSFile(repoId, file, sha256, onProgress) {
|
||||
*/
|
||||
export function formatFileSize(bytes) {
|
||||
if (!bytes || bytes === 0) return "0 B";
|
||||
if (bytes < 1024) return bytes + " B";
|
||||
if (bytes < 1024 * 1024) return (bytes / 1024).toFixed(1) + " KB";
|
||||
if (bytes < 1024 * 1024 * 1024)
|
||||
return (bytes / (1024 * 1024)).toFixed(1) + " MB";
|
||||
return (bytes / (1024 * 1024 * 1024)).toFixed(1) + " GB";
|
||||
if (bytes < 1000) return bytes + " B";
|
||||
if (bytes < 1000 * 1000) return (bytes / 1000).toFixed(1) + " KB";
|
||||
if (bytes < 1000 * 1000 * 1000)
|
||||
return (bytes / (1000 * 1000)).toFixed(1) + " MB";
|
||||
return (bytes / (1000 * 1000 * 1000)).toFixed(1) + " GB";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user