enhance(frontend): サイズ制限を超過するファイルをアップロードしようとした際にエラーを出すように
This commit is contained in:
		| @@ -13,6 +13,7 @@ import { apiUrl } from '@/config.js'; | ||||
| import { $i } from '@/account.js'; | ||||
| import { alert } from '@/os.js'; | ||||
| import { i18n } from '@/i18n.js'; | ||||
| import { instance } from '@/instance.js'; | ||||
|  | ||||
| type Uploading = { | ||||
| 	id: string; | ||||
| @@ -39,6 +40,15 @@ export function uploadFile( | ||||
|  | ||||
| 	if (folder && typeof folder === 'object') folder = folder.id; | ||||
|  | ||||
| 	if (file.size > instance.maxFileSize) { | ||||
| 		alert({ | ||||
| 			type: 'error', | ||||
| 			title: i18n.ts.failedToUpload, | ||||
| 			text: i18n.ts.cannotUploadBecauseExceedsFileSizeLimit, | ||||
| 		}); | ||||
| 		return Promise.reject(); | ||||
| 	} | ||||
|  | ||||
| 	return new Promise((resolve, reject) => { | ||||
| 		const id = uuid(); | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 syuilo
					syuilo