Bug 1007112 - Add default mime type for pick action if unspecified. r=myk
authorMartyn Haigh <martyn.haigh@gmail.com>
Mon, 23 Jun 2014 10:47:00 -0400
changeset 190644 6d74858661ae3f4f2fda2440471db1e2c484b37f
parent 190643 b043afd9261faa92ac9a511c59c170a5b98195bd
child 190645 838aa70f96c0a17fa37b4571409af4c72b89de30
push id1
push userroot
push dateMon, 20 Oct 2014 17:29:22 +0000
reviewersmyk
bugs1007112
milestone33.0a1
Bug 1007112 - Add default mime type for pick action if unspecified. r=myk
mobile/android/base/util/WebActivityMapper.java
--- a/mobile/android/base/util/WebActivityMapper.java
+++ b/mobile/android/base/util/WebActivityMapper.java
@@ -103,16 +103,23 @@ public final class WebActivityMapper {
         }
     }
 
     private static class PickMapping extends BaseMapping {
         @Override
         public String getAction() {
             return Intent.ACTION_GET_CONTENT;
         }
+
+        @Override
+        public String getMime(JSONObject data) throws JSONException {
+            // bug 1007112 - pick action needs a mimetype to work
+            String mime = data.optString("type", null);
+            return !TextUtils.isEmpty(mime) ? mime : "*/*";
+        }
     }
 
     private static class SendMapping extends BaseMapping {
         @Override
         public String getAction() {
             return Intent.ACTION_SEND;
         }