chore: remove file size limit (#5974)

* chore: remove file size limit

* chore: flutter analyze
This commit is contained in:
Nathan.fooo 2024-08-17 21:51:36 +08:00 committed by GitHub
parent 9853fbfc10
commit c2d7c5360d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 7 additions and 27 deletions

View File

@ -3,7 +3,6 @@ import 'dart:io';
import 'package:appflowy/generated/locale_keys.g.dart';
import 'package:appflowy/plugins/document/application/document_service.dart';
import 'package:appflowy/startup/startup.dart';
import 'package:appflowy/util/file_extension.dart';
import 'package:appflowy/workspace/application/settings/application_data_storage.dart';
import 'package:appflowy_backend/dispatch/error.dart';
import 'package:appflowy_backend/log.dart';
@ -39,14 +38,6 @@ Future<(String? path, String? errorMessage)> saveFileToCloudStorage(
String localFilePath,
String documentId,
) async {
final size = localFilePath.fileSize;
if (size == null || size > 10 * 1024 * 1024) {
// 10MB
return (
null,
LocaleKeys.document_plugins_file_fileTooBigError.tr(),
);
}
final documentService = DocumentService();
Log.debug("Uploading file from local path: $localFilePath");
final result = await documentService.uploadFile(

View File

@ -7,7 +7,6 @@ import 'package:appflowy/plugins/document/application/prelude.dart';
import 'package:appflowy/plugins/document/presentation/editor_plugins/image/common.dart';
import 'package:appflowy/shared/custom_image_cache_manager.dart';
import 'package:appflowy/startup/startup.dart';
import 'package:appflowy/util/file_extension.dart';
import 'package:appflowy/workspace/application/settings/application_data_storage.dart';
import 'package:appflowy/workspace/presentation/home/toast.dart';
import 'package:appflowy_backend/dispatch/error.dart';
@ -47,14 +46,6 @@ Future<(String? path, String? errorMessage)> saveImageToCloudStorage(
String localImagePath,
String documentId,
) async {
final size = localImagePath.fileSize;
if (size == null || size > 10 * 1024 * 1024) {
// 10MB
return (
null,
LocaleKeys.document_imageBlock_uploadImageErrorImageSizeTooBig.tr(),
);
}
final documentService = DocumentService();
Log.debug("Uploading image local path: $localImagePath");
final result = await documentService.uploadFile(

View File

@ -11,15 +11,13 @@ export function UploadImage({ onDone }: { onDone?: (url: string) => void }) {
const checkTauriFile = useCallback(
async (url: string) => {
const { readBinaryFile } = await import('@tauri-apps/api/fs');
const buffer = await readBinaryFile(url);
const blob = new Blob([buffer]);
if (blob.size > MAX_IMAGE_SIZE) {
notify.error(t('document.imageBlock.error.invalidImageSize'));
return false;
}
// const { readBinaryFile } = await import('@tauri-apps/api/fs');
// const buffer = await readBinaryFile(url);
// const blob = new Blob([buffer]);
// if (blob.size > MAX_IMAGE_SIZE) {
// notify.error(t('document.imageBlock.error.invalidImageSize'));
// return false;
// }
return true;
},