Skip to content

Commit

Permalink
that should do it
Browse files Browse the repository at this point in the history
workaround for dart-lang/mime#102

fixes #223 (hopefully)
  • Loading branch information
TheLastGimbus committed Sep 11, 2023
1 parent f42822d commit 6ed4859
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions lib/utils.dart
Expand Up @@ -30,15 +30,25 @@ extension X on Iterable<FileSystemEntity> {
/// Easy extension allowing you to filter for files that are photo or video
Iterable<File> wherePhotoVideo() => whereType<File>().where((e) {
final mime = lookupMimeType(e.path) ?? "";
return mime.startsWith('image/') || mime.startsWith('video/');
return mime.startsWith('image/') ||
mime.startsWith('video/') ||
// https://github.com/TheLastGimbus/GooglePhotosTakeoutHelper/issues/223
// https://github.com/dart-lang/mime/issues/102
// 🙃🙃
mime == 'model/vnd.mts';
});
}

extension Y on Stream<FileSystemEntity> {
/// Easy extension allowing you to filter for files that are photo or video
Stream<File> wherePhotoVideo() => whereType<File>().where((e) {
final mime = lookupMimeType(e.path) ?? "";
return mime.startsWith('image/') || mime.startsWith('video/');
return mime.startsWith('image/') ||
mime.startsWith('video/') ||
// https://github.com/TheLastGimbus/GooglePhotosTakeoutHelper/issues/223
// https://github.com/dart-lang/mime/issues/102
// 🙃🙃
mime == 'model/vnd.mts';
});
}

Expand Down

0 comments on commit 6ed4859

Please sign in to comment.