This commit is contained in:
Thibault Deckers 2023-04-18 19:40:16 +02:00
parent 53d758ccbb
commit 94af48a97f
4 changed files with 15 additions and 13 deletions

View file

@ -27,7 +27,7 @@ extension ExtraAvesEntryMetadataEdition on AvesEntry {
final appliedModifier = await _applyDateModifierToEntry(userModifier);
if (appliedModifier == null) {
if (!isMissingAtPath && userModifier.action != DateEditAction.copyField) {
if (isValid && userModifier.action != DateEditAction.copyField) {
await reportService.recordError('failed to get date for modifier=$userModifier, entry=$this', null);
}
return {};

View file

@ -12,6 +12,8 @@ import 'package:aves/theme/text.dart';
import 'package:aves/utils/android_file_utils.dart';
extension ExtraAvesEntryProps on AvesEntry {
bool get isValid => !isMissingAtPath && sizeBytes != 0 && width > 0 && height > 0;
// type
String get mimeTypeAnySubtype => mimeType.replaceAll(RegExp('/.*'), '/*');

View file

@ -123,7 +123,7 @@ class PlatformMetadataEditService implements MetadataEditService {
}
Future<void> _processPlatformException(AvesEntry entry, PlatformException e, StackTrace stack) async {
if (!entry.isMissingAtPath) {
if (entry.isValid) {
final code = e.code;
if (code.endsWith('mp4largemoov')) {
await reportService.recordError(_Mp4LargeMoovException(code: e.code, message: e.message, details: e.details, stacktrace: e.stacktrace), stack);

View file

@ -58,7 +58,7 @@ class PlatformMetadataFetchService implements MetadataFetchService {
});
if (result != null) return result as Map;
} on PlatformException catch (e, stack) {
if (!entry.isMissingAtPath) {
if (entry.isValid) {
await reportService.recordError(e, stack);
}
}
@ -96,7 +96,7 @@ class PlatformMetadataFetchService implements MetadataFetchService {
result['id'] = entry.id;
return CatalogMetadata.fromMap(result);
} on PlatformException catch (e, stack) {
if (!entry.isMissingAtPath) {
if (entry.isValid) {
await reportService.recordError(e, stack);
}
}
@ -124,7 +124,7 @@ class PlatformMetadataFetchService implements MetadataFetchService {
}) as Map;
return OverlayMetadata.fromMap(result);
} on PlatformException catch (e, stack) {
if (!entry.isMissingAtPath) {
if (entry.isValid) {
await reportService.recordError(e, stack);
}
}
@ -141,7 +141,7 @@ class PlatformMetadataFetchService implements MetadataFetchService {
}) as Map;
return GeoTiffInfo.fromMap(result);
} on PlatformException catch (e, stack) {
if (!entry.isMissingAtPath) {
if (entry.isValid) {
await reportService.recordError(e, stack);
}
}
@ -166,7 +166,7 @@ class PlatformMetadataFetchService implements MetadataFetchService {
}
return MultiPageInfo.fromPageMaps(entry, pageMaps);
} on PlatformException catch (e, stack) {
if (!entry.isMissingAtPath) {
if (entry.isValid) {
await reportService.recordError(e, stack);
}
}
@ -186,7 +186,7 @@ class PlatformMetadataFetchService implements MetadataFetchService {
}) as Map;
return PanoramaInfo.fromMap(result);
} on PlatformException catch (e, stack) {
if (!entry.isMissingAtPath) {
if (entry.isValid) {
await reportService.recordError(e, stack);
}
}
@ -202,7 +202,7 @@ class PlatformMetadataFetchService implements MetadataFetchService {
});
if (result != null) return (result as List).cast<Map>().map((fields) => fields.cast<String, dynamic>()).toList();
} on PlatformException catch (e, stack) {
if (!entry.isMissingAtPath) {
if (entry.isValid) {
await reportService.recordError(e, stack);
}
}
@ -219,7 +219,7 @@ class PlatformMetadataFetchService implements MetadataFetchService {
});
if (result != null) return AvesXmp.fromList((result as List).cast<String>());
} on PlatformException catch (e, stack) {
if (!entry.isMissingAtPath) {
if (entry.isValid) {
await reportService.recordError(e, stack);
}
}
@ -254,7 +254,7 @@ class PlatformMetadataFetchService implements MetadataFetchService {
'prop': prop,
});
} on PlatformException catch (e, stack) {
if (!entry.isMissingAtPath) {
if (entry.isValid) {
await reportService.recordError(e, stack);
}
}
@ -274,7 +274,7 @@ class PlatformMetadataFetchService implements MetadataFetchService {
return dateTimeFromMillis(result, isUtc: false);
}
} on PlatformException catch (e, stack) {
if (!entry.isMissingAtPath) {
if (entry.isValid) {
await reportService.recordError(e, stack);
}
}
@ -290,7 +290,7 @@ class PlatformMetadataFetchService implements MetadataFetchService {
'sizeBytes': entry.sizeBytes,
});
} on PlatformException catch (e, stack) {
if (!entry.isMissingAtPath) {
if (entry.isValid) {
await reportService.recordError(e, stack);
}
}