mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-26 12:23:58 +01:00
Fix DNG/RAW Upload Error (#5543)
* Fix DNG/RAW Upload Error * Fix DNG/RAW Upload Error * supported formats added * cleanup
This commit is contained in:
parent
1cbce77d5f
commit
2d5b7cc579
2 changed files with 15 additions and 4 deletions
|
|
@ -11,7 +11,9 @@ import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import kotlinx.coroutines.withContext
|
import kotlinx.coroutines.withContext
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import java.util.*
|
import java.util.Calendar
|
||||||
|
import java.util.Date
|
||||||
|
import java.util.Locale
|
||||||
import kotlin.coroutines.CoroutineContext
|
import kotlin.coroutines.CoroutineContext
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -90,6 +92,12 @@ class ImageFileLoader(val context: Context) : CoroutineScope{
|
||||||
}
|
}
|
||||||
|
|
||||||
if (file != null && file.exists() && name != null && path != null && bucketName != null) {
|
if (file != null && file.exists() && name != null && path != null && bucketName != null) {
|
||||||
|
val extension = path.substringAfterLast(".", "")
|
||||||
|
// Check if the extension is one of the allowed types
|
||||||
|
if (extension.lowercase(Locale.ROOT) !in arrayOf("jpg", "jpeg", "png", "svg", "gif", "tiff", "webp", "xcf")) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
val uri = ContentUris.withAppendedId(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, id)
|
val uri = ContentUris.withAppendedId(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, id)
|
||||||
|
|
||||||
val calendar = Calendar.getInstance()
|
val calendar = Calendar.getInstance()
|
||||||
|
|
@ -130,4 +138,4 @@ class ImageFileLoader(val context: Context) : CoroutineScope{
|
||||||
* Sha1 for image (original image).
|
* Sha1 for image (original image).
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -48,8 +48,11 @@ public class FilePicker implements Constants {
|
||||||
boolean openDocumentIntentPreferred) {
|
boolean openDocumentIntentPreferred) {
|
||||||
// storing picked image type to shared preferences
|
// storing picked image type to shared preferences
|
||||||
storeType(context, type);
|
storeType(context, type);
|
||||||
|
//Supported types are SVG, PNG and JPEG,GIF, TIFF, WebP, XCF
|
||||||
|
final String[] mimeTypes = { "image/jpg","image/png","image/jpeg", "image/gif", "image/tiff", "image/webp", "image/xcf", "image/svg+xml", "image/webp"};
|
||||||
return plainGalleryPickerIntent(openDocumentIntentPreferred)
|
return plainGalleryPickerIntent(openDocumentIntentPreferred)
|
||||||
.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, configuration(context).allowsMultiplePickingInGallery());
|
.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, configuration(context).allowsMultiplePickingInGallery())
|
||||||
|
.putExtra(Intent.EXTRA_MIME_TYPES, mimeTypes);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -401,4 +404,4 @@ public class FilePicker implements Constants {
|
||||||
|
|
||||||
void onCanceled(FilePicker.ImageSource source, int type);
|
void onCanceled(FilePicker.ImageSource source, int type);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue