mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
chore: remove file size limit (#5974)
* chore: remove file size limit * chore: flutter analyze
This commit is contained in:
parent
9853fbfc10
commit
c2d7c5360d
@ -3,7 +3,6 @@ import 'dart:io';
|
|||||||
import 'package:appflowy/generated/locale_keys.g.dart';
|
import 'package:appflowy/generated/locale_keys.g.dart';
|
||||||
import 'package:appflowy/plugins/document/application/document_service.dart';
|
import 'package:appflowy/plugins/document/application/document_service.dart';
|
||||||
import 'package:appflowy/startup/startup.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/application/settings/application_data_storage.dart';
|
||||||
import 'package:appflowy_backend/dispatch/error.dart';
|
import 'package:appflowy_backend/dispatch/error.dart';
|
||||||
import 'package:appflowy_backend/log.dart';
|
import 'package:appflowy_backend/log.dart';
|
||||||
@ -39,14 +38,6 @@ Future<(String? path, String? errorMessage)> saveFileToCloudStorage(
|
|||||||
String localFilePath,
|
String localFilePath,
|
||||||
String documentId,
|
String documentId,
|
||||||
) async {
|
) async {
|
||||||
final size = localFilePath.fileSize;
|
|
||||||
if (size == null || size > 10 * 1024 * 1024) {
|
|
||||||
// 10MB
|
|
||||||
return (
|
|
||||||
null,
|
|
||||||
LocaleKeys.document_plugins_file_fileTooBigError.tr(),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
final documentService = DocumentService();
|
final documentService = DocumentService();
|
||||||
Log.debug("Uploading file from local path: $localFilePath");
|
Log.debug("Uploading file from local path: $localFilePath");
|
||||||
final result = await documentService.uploadFile(
|
final result = await documentService.uploadFile(
|
||||||
|
@ -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/plugins/document/presentation/editor_plugins/image/common.dart';
|
||||||
import 'package:appflowy/shared/custom_image_cache_manager.dart';
|
import 'package:appflowy/shared/custom_image_cache_manager.dart';
|
||||||
import 'package:appflowy/startup/startup.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/application/settings/application_data_storage.dart';
|
||||||
import 'package:appflowy/workspace/presentation/home/toast.dart';
|
import 'package:appflowy/workspace/presentation/home/toast.dart';
|
||||||
import 'package:appflowy_backend/dispatch/error.dart';
|
import 'package:appflowy_backend/dispatch/error.dart';
|
||||||
@ -47,14 +46,6 @@ Future<(String? path, String? errorMessage)> saveImageToCloudStorage(
|
|||||||
String localImagePath,
|
String localImagePath,
|
||||||
String documentId,
|
String documentId,
|
||||||
) async {
|
) async {
|
||||||
final size = localImagePath.fileSize;
|
|
||||||
if (size == null || size > 10 * 1024 * 1024) {
|
|
||||||
// 10MB
|
|
||||||
return (
|
|
||||||
null,
|
|
||||||
LocaleKeys.document_imageBlock_uploadImageErrorImageSizeTooBig.tr(),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
final documentService = DocumentService();
|
final documentService = DocumentService();
|
||||||
Log.debug("Uploading image local path: $localImagePath");
|
Log.debug("Uploading image local path: $localImagePath");
|
||||||
final result = await documentService.uploadFile(
|
final result = await documentService.uploadFile(
|
||||||
|
@ -11,15 +11,13 @@ export function UploadImage({ onDone }: { onDone?: (url: string) => void }) {
|
|||||||
|
|
||||||
const checkTauriFile = useCallback(
|
const checkTauriFile = useCallback(
|
||||||
async (url: string) => {
|
async (url: string) => {
|
||||||
const { readBinaryFile } = await import('@tauri-apps/api/fs');
|
// const { readBinaryFile } = await import('@tauri-apps/api/fs');
|
||||||
|
// const buffer = await readBinaryFile(url);
|
||||||
const buffer = await readBinaryFile(url);
|
// const blob = new Blob([buffer]);
|
||||||
const blob = new Blob([buffer]);
|
// if (blob.size > MAX_IMAGE_SIZE) {
|
||||||
|
// notify.error(t('document.imageBlock.error.invalidImageSize'));
|
||||||
if (blob.size > MAX_IMAGE_SIZE) {
|
// return false;
|
||||||
notify.error(t('document.imageBlock.error.invalidImageSize'));
|
// }
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user