From cd2d67e93e37209b8e60785fc49498b4dbcf4e9a Mon Sep 17 00:00:00 2001 From: FlashSystems Date: Tue, 14 Jul 2015 19:30:20 +0200 Subject: [PATCH] Bugfix: Request parameters are duplicated over and over if request is repeated. --- .../nutomic/syncthingandroid/syncthing/GetTask.java | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/nutomic/syncthingandroid/syncthing/GetTask.java b/src/main/java/com/nutomic/syncthingandroid/syncthing/GetTask.java index 946aff3a..5d777a03 100644 --- a/src/main/java/com/nutomic/syncthingandroid/syncthing/GetTask.java +++ b/src/main/java/com/nutomic/syncthingandroid/syncthing/GetTask.java @@ -55,14 +55,15 @@ public class GetTask extends AsyncTask { String fullUri = params[0] + params[1]; Log.v(TAG, "Calling Rest API at " + fullUri); + if (params.length == 5) { + LinkedList urlParams = new LinkedList<>(); + urlParams.add(new BasicNameValuePair(params[3], params[4])); + fullUri += "?" + URLEncodedUtils.format(urlParams, HTTP.UTF_8); + } + // Retry at most 10 times before failing for (int i = 0; i < 10; i++) { HttpClient httpclient = Https.createHttpsClient(mHttpsCertPath); - if (params.length == 5) { - LinkedList urlParams = new LinkedList<>(); - urlParams.add(new BasicNameValuePair(params[3], params[4])); - fullUri += "?" + URLEncodedUtils.format(urlParams, HTTP.UTF_8); - } HttpGet get = new HttpGet(fullUri); get.addHeader(new BasicHeader(RestApi.HEADER_API_KEY, params[2]));