You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by an...@apache.org on 2015/07/20 12:30:44 UTC

android commit: CB-9343 Split the Content-Type to obtain a clean mimetype

Repository: cordova-android
Updated Branches:
  refs/heads/master 92caa3a18 -> fab472859


CB-9343 Split the Content-Type to obtain a clean mimetype

This closes #197


Project: http://git-wip-us.apache.org/repos/asf/cordova-android/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-android/commit/fab47285
Tree: http://git-wip-us.apache.org/repos/asf/cordova-android/tree/fab47285
Diff: http://git-wip-us.apache.org/repos/asf/cordova-android/diff/fab47285

Branch: refs/heads/master
Commit: fab472859dad60a65a3fb0e8c10c84e0e3255550
Parents: 92caa3a
Author: Simon Pireyn <sp...@gmail.com>
Authored: Thu Jul 9 20:00:10 2015 +0200
Committer: Vladimir Kotikov <v-...@microsoft.com>
Committed: Mon Jul 20 13:28:40 2015 +0300

----------------------------------------------------------------------
 framework/src/org/apache/cordova/CordovaResourceApi.java | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-android/blob/fab47285/framework/src/org/apache/cordova/CordovaResourceApi.java
----------------------------------------------------------------------
diff --git a/framework/src/org/apache/cordova/CordovaResourceApi.java b/framework/src/org/apache/cordova/CordovaResourceApi.java
index 0390bb0..e725e25 100644
--- a/framework/src/org/apache/cordova/CordovaResourceApi.java
+++ b/framework/src/org/apache/cordova/CordovaResourceApi.java
@@ -188,7 +188,11 @@ public class CordovaResourceApi {
                     HttpURLConnection conn = (HttpURLConnection)new URL(uri.toString()).openConnection();
                     conn.setDoInput(false);
                     conn.setRequestMethod("HEAD");
-                    return conn.getHeaderField("Content-Type");
+                    String mimeType = conn.getHeaderField("Content-Type");
+                    if (mimeType != null) {
+                        mimeType = mimeType.split(";")[0];
+                    }
+                    return mimeType;
                 } catch (IOException e) {
                 }
             }
@@ -283,6 +287,9 @@ public class CordovaResourceApi {
                 HttpURLConnection conn = (HttpURLConnection)new URL(uri.toString()).openConnection();
                 conn.setDoInput(true);
                 String mimeType = conn.getHeaderField("Content-Type");
+                if (mimeType != null) {
+                    mimeType = mimeType.split(";")[0];
+                }
                 int length = conn.getContentLength();
                 InputStream inputStream = conn.getInputStream();
                 return new OpenForReadResult(uri, inputStream, mimeType, length, null);


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org