Merge pull request #1976 from famedly/krille/use-correct-file-size-calculation
fix: Use MB and KB instead of MiB and KiB for file sizes
This commit is contained in:
commit
258ca37692
|
|
@ -3950,9 +3950,9 @@ class FileTooBigMatrixException extends MatrixException {
|
|||
int maxFileSize;
|
||||
|
||||
static String _formatFileSize(int size) {
|
||||
if (size < 1024) return '$size B';
|
||||
final i = (log(size) / log(1024)).floor();
|
||||
final num = (size / pow(1024, i));
|
||||
if (size < 1000) return '$size B';
|
||||
final i = (log(size) / log(1000)).floor();
|
||||
final num = (size / pow(1000, i));
|
||||
final round = num.round();
|
||||
final numString = round < 10
|
||||
? num.toStringAsFixed(2)
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ import 'package:matrix/matrix.dart';
|
|||
import 'package:matrix/src/utils/queued_to_device_event.dart';
|
||||
|
||||
abstract class DatabaseApi {
|
||||
int get maxFileSize => 1 * 1024 * 1024;
|
||||
int get maxFileSize => 1 * 1000 * 1000;
|
||||
|
||||
bool get supportsFileStoring => false;
|
||||
|
||||
|
|
|
|||
|
|
@ -204,7 +204,7 @@ void main() {
|
|||
);
|
||||
});
|
||||
test('Database can write and read 5MB data', () async {
|
||||
final hugeDataObject = {'foo': createLargeString('A', 5 * 1024 * 1024)};
|
||||
final hugeDataObject = {'foo': createLargeString('A', 5 * 1000 * 1000)};
|
||||
|
||||
await database.storeAccountData(
|
||||
'm.huge_data_test',
|
||||
|
|
|
|||
Loading…
Reference in New Issue