1
0
mirror of https://github.com/immich-app/immich.git synced 2024-12-23 02:06:15 +02:00
immich/mobile/lib/utils/files_helper.dart
Alex 3bdcdef198
Fixed backup stuck at unsupported format (#108)
* Added webp as supported file type, allow continue upload when an image fail

* Added webp as supported file type, allow continue upload when an image fail

* Solved issue with bad assets cause backup to stop
2022-04-04 23:37:48 -05:00

46 lines
1.1 KiB
Dart

import 'package:path/path.dart' as p;
class FileHelper {
static getMimeType(String filePath) {
var fileExtension = p.extension(filePath).split(".")[1];
switch (fileExtension.toLowerCase()) {
case 'gif':
return {"type": "image", "subType": "gif"};
case 'jpeg':
return {"type": "image", "subType": "jpeg"};
case 'jpg':
return {"type": "image", "subType": "jpeg"};
case 'png':
return {"type": "image", "subType": "png"};
case 'mov':
return {"type": "video", "subType": "quicktime"};
case 'mp4':
return {"type": "video", "subType": "mp4"};
case 'avi':
return {"type": "video", "subType": "x-msvideo"};
case 'heic':
return {"type": "image", "subType": "heic"};
case 'heif':
return {"type": "image", "subType": "heif"};
case 'dng':
return {"type": "image", "subType": "dng"};
case 'webp':
return {"type": "image", "subType": "webp"};
default:
return {"type": "unsupport", "subType": "unsupport"};
}
}
}