Android: improved image type detection
|
@ -90,8 +90,8 @@ android {
|
|||
applicationId "net.cozic.joplin"
|
||||
minSdkVersion 16
|
||||
targetSdkVersion 22
|
||||
versionCode 62
|
||||
versionName "0.10.49"
|
||||
versionCode 64
|
||||
versionName "0.10.51"
|
||||
ndk {
|
||||
abiFilters "armeabi-v7a", "x86"
|
||||
}
|
||||
|
|
Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 3.6 KiB |
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 2.4 KiB |
Before Width: | Height: | Size: 3.3 KiB After Width: | Height: | Size: 4.9 KiB |
Before Width: | Height: | Size: 5.5 KiB After Width: | Height: | Size: 7.8 KiB |
|
@ -276,6 +276,15 @@ class NoteScreenComponent extends BaseScreenComponent {
|
|||
mimeType = mimeUtils.fromFileExtension(ext);
|
||||
}
|
||||
|
||||
if (!mimeType && fileType === 'image') {
|
||||
// Assume JPEG if we couldn't determine the file type. It seems to happen with the image picker
|
||||
// when the file path is something like content://media/external/images/media/123456
|
||||
// If the image is not a JPEG, something will throw an error below, but there's a good chance
|
||||
// it will work.
|
||||
reg.logger().info('Missing file type and could not detect it - assuming image/jpg');
|
||||
mimeType = 'image/jpg';
|
||||
}
|
||||
|
||||
reg.logger().info('Got file: ' + localFilePath);
|
||||
reg.logger().info('Got type: ' + mimeType);
|
||||
|
||||
|
|