summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/com/android/gallery3d/data/UriSource.java14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/com/android/gallery3d/data/UriSource.java b/src/com/android/gallery3d/data/UriSource.java
index 76f7ac0e5..d37c51d13 100644
--- a/src/com/android/gallery3d/data/UriSource.java
+++ b/src/com/android/gallery3d/data/UriSource.java
@@ -28,6 +28,8 @@ import java.net.URLEncoder;
class UriSource extends MediaSource {
@SuppressWarnings("unused")
private static final String TAG = "UriSource";
+ private static final String IMAGE_TYPE_PREFIX = "image/";
+ private static final String IMAGE_TYPE_ANY = "image/*";
private GalleryApp mApplication;
@@ -64,11 +66,19 @@ class UriSource extends MediaSource {
@Override
public Path findPathByUri(Uri uri, String type) {
- if (type == null) type = getMimeType(uri);
- if (type.startsWith("image/")) {
+ String mimeType = getMimeType(uri);
+
+ // Try to find a most specific type but it has to be started with "image/"
+ if ((type == null) || (IMAGE_TYPE_ANY.equals(type)
+ && mimeType.startsWith(IMAGE_TYPE_PREFIX))) {
+ type = mimeType;
+ }
+
+ if (type.startsWith(IMAGE_TYPE_PREFIX)) {
return Path.fromString("/uri/" + URLEncoder.encode(uri.toString())
+ "/" +URLEncoder.encode(type));
}
+ // We have no clues that it is an image
return null;
}
}