You've already forked AstralRinth
forked from didirus/AstralRinth
fix: unclear file upload errors temp fix (#3811)
This commit is contained in:
@@ -39,7 +39,7 @@
|
|||||||
/>
|
/>
|
||||||
<XCircleIcon
|
<XCircleIcon
|
||||||
v-show="
|
v-show="
|
||||||
item.status === 'error' ||
|
item.status.includes('error') ||
|
||||||
item.status === 'cancelled' ||
|
item.status === 'cancelled' ||
|
||||||
item.status === 'incorrect-type'
|
item.status === 'incorrect-type'
|
||||||
"
|
"
|
||||||
@@ -54,9 +54,14 @@
|
|||||||
<template v-if="item.status === 'completed'">
|
<template v-if="item.status === 'completed'">
|
||||||
<span>Done</span>
|
<span>Done</span>
|
||||||
</template>
|
</template>
|
||||||
<template v-else-if="item.status === 'error'">
|
<template v-else-if="item.status === 'error-file-exists'">
|
||||||
<span class="text-red">Failed - File already exists</span>
|
<span class="text-red">Failed - File already exists</span>
|
||||||
</template>
|
</template>
|
||||||
|
<template v-else-if="item.status === 'error-generic'">
|
||||||
|
<span class="text-red"
|
||||||
|
>Failed - {{ item.error?.message || "An unexpected error occured." }}</span
|
||||||
|
>
|
||||||
|
</template>
|
||||||
<template v-else-if="item.status === 'incorrect-type'">
|
<template v-else-if="item.status === 'incorrect-type'">
|
||||||
<span class="text-red">Failed - Incorrect file type</span>
|
<span class="text-red">Failed - Incorrect file type</span>
|
||||||
</template>
|
</template>
|
||||||
@@ -104,9 +109,17 @@ import { FSModule } from "~/composables/servers/modules/fs.ts";
|
|||||||
interface UploadItem {
|
interface UploadItem {
|
||||||
file: File;
|
file: File;
|
||||||
progress: number;
|
progress: number;
|
||||||
status: "pending" | "uploading" | "completed" | "error" | "cancelled" | "incorrect-type";
|
status:
|
||||||
|
| "pending"
|
||||||
|
| "uploading"
|
||||||
|
| "completed"
|
||||||
|
| "error-file-exists"
|
||||||
|
| "error-generic"
|
||||||
|
| "cancelled"
|
||||||
|
| "incorrect-type";
|
||||||
size: string;
|
size: string;
|
||||||
uploader?: any;
|
uploader?: any;
|
||||||
|
error?: Error;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
@@ -245,8 +258,18 @@ const uploadFile = async (file: File) => {
|
|||||||
console.error("Error uploading file:", error);
|
console.error("Error uploading file:", error);
|
||||||
const index = uploadQueue.value.findIndex((item) => item.file.name === file.name);
|
const index = uploadQueue.value.findIndex((item) => item.file.name === file.name);
|
||||||
if (index !== -1 && uploadQueue.value[index].status !== "cancelled") {
|
if (index !== -1 && uploadQueue.value[index].status !== "cancelled") {
|
||||||
uploadQueue.value[index].status =
|
const target = uploadQueue.value[index];
|
||||||
error instanceof Error && error.message === badFileTypeMsg ? "incorrect-type" : "error";
|
|
||||||
|
if (error instanceof Error) {
|
||||||
|
if (error.message === badFileTypeMsg) {
|
||||||
|
target.status = "incorrect-type";
|
||||||
|
} else if (target.progress === 100 && error.message.includes("401")) {
|
||||||
|
target.status = "error-file-exists";
|
||||||
|
} else {
|
||||||
|
target.status = "error-generic";
|
||||||
|
target.error = error;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
setTimeout(async () => {
|
setTimeout(async () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user