You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by GitBox <gi...@apache.org> on 2017/11/22 00:23:59 UTC

[GitHub] maverickmishra closed pull request #174: CB-12399: (Android) Fix bug with WebView & CookieManager cookies

maverickmishra closed pull request #174: CB-12399: (Android) Fix bug with WebView & CookieManager cookies
URL: https://github.com/apache/cordova-plugin-file-transfer/pull/174
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/src/android/FileTransfer.java b/src/android/FileTransfer.java
index de15981..d43f6f4 100644
--- a/src/android/FileTransfer.java
+++ b/src/android/FileTransfer.java
@@ -236,7 +236,6 @@ private static void addHeadersToRequest(URLConnection connection, JSONObject hea
     }
 
     private String getCookies(final String target) {
-        boolean gotCookie = false;
         String cookie = null;
         Class webViewClass = webView.getClass();
         try {
@@ -249,15 +248,19 @@ private String getCookies(final String target) {
                             gcmMethod.invoke(webView)
                         ), target);
 
-            gotCookie = true;
         } catch (NoSuchMethodException e) {
         } catch (IllegalAccessException e) {
         } catch (InvocationTargetException e) {
         } catch (ClassCastException e) {
         }
 
-        if (!gotCookie && CookieManager.getInstance() != null) {
-            cookie = CookieManager.getInstance().getCookie(target);
+        if (CookieManager.getInstance() != null) {
+            String cmCookie = CookieManager.getInstance().getCookie(target);
+            if (cookie != null) {
+                cookie += "; " + cmCookie;
+            } else {
+                cookie = cmCookie;
+            }
         }
 
         return cookie;


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

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