[
https://issues.apache.org/jira/browse/CB-12399?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16261746#comment-16261746
]
ASF GitHub Bot commented on CB-12399:
-------------------------------------
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:
[email protected]
> FileTransfer only uses WebView cookies if available
> ---------------------------------------------------
>
> Key: CB-12399
> URL: https://issues.apache.org/jira/browse/CB-12399
> Project: Apache Cordova
> Issue Type: Bug
> Components: cordova-plugin-file-transfer (DEPRECATED)
> Affects Versions: Master
> Environment: Android
> Reporter: James Harless
> Priority: Minor
>
> Came across this bug a few weeks ago where FileTransfer will use WebView
> cookies over CookieManager cookies. This can be a major source of confusion
> if WebView receives a cookie with a hybrid app where cookies are handled by
> CookieManager.
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]