Skip to content

Commit 88f0511

Browse files
committed
Revert "fix: file types whitelist of upload"
This reverts commit d7f2965.
1 parent d822b74 commit 88f0511

File tree

1 file changed

+0
-51
lines changed
  • web/apps/web/src/services/common

1 file changed

+0
-51
lines changed

web/apps/web/src/services/common/index.ts

-51
Original file line numberDiff line numberDiff line change
@@ -6,61 +6,10 @@ export interface UploadResponse {
66
url: string;
77
}
88

9-
const ALLOWED_FILE_TYPES = [
10-
// 图片类型
11-
'image/jpeg',
12-
'image/png',
13-
'image/gif',
14-
'image/webp',
15-
'image/svg+xml',
16-
'image/bmp',
17-
'image/tiff',
18-
// 音频类型
19-
'audio/mpeg',
20-
'audio/ogg',
21-
'audio/wav',
22-
'audio/webm',
23-
'audio/aac',
24-
'audio/flac',
25-
'audio/mp4',
26-
// 视频类型
27-
'video/mp4',
28-
'video/webm',
29-
'video/ogg',
30-
'video/quicktime',
31-
'video/x-msvideo',
32-
'video/x-matroska',
33-
// 文档类型
34-
'application/pdf',
35-
'application/msword',
36-
'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
37-
'application/vnd.ms-excel',
38-
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
39-
'application/vnd.ms-powerpoint',
40-
'application/vnd.openxmlformats-officedocument.presentationml.presentation',
41-
// 其他常见文件类型
42-
'text/plain',
43-
'text/html',
44-
'text/csv',
45-
'application/json',
46-
'application/zip',
47-
'application/x-rar-compressed',
48-
];
49-
509
export async function upload(
5110
file: File,
5211
name?: string,
5312
): Promise<UploadResponse> {
54-
if (!ALLOWED_FILE_TYPES.includes(file.type)) {
55-
toast.error('Not supported file type', {
56-
position: 'top-center',
57-
autoClose: 2000,
58-
hideProgressBar: true,
59-
pauseOnHover: true,
60-
closeButton: false,
61-
});
62-
return { url: '' };
63-
}
6413
const formData = new FormData();
6514
formData.append('file', file, name || file.name);
6615
const response = await APIFetch.post<{ file_path: string }>('/api/upload', {

0 commit comments

Comments
 (0)