From 7696c085652a4e68640f9497748b9986ba39892d Mon Sep 17 00:00:00 2001 From: masensio Date: Thu, 9 Apr 2015 11:16:13 +0200 Subject: [PATCH] Hotfix user_agent --- res/values/setup.xml | 2 +- src/com/owncloud/android/MainApp.java | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/res/values/setup.xml b/res/values/setup.xml index 0c341bd8ff..524aa2a323 100644 --- a/res/values/setup.xml +++ b/res/values/setup.xml @@ -9,7 +9,7 @@ owncloud Owncloud_ ownCloud - Mozilla/5.0 (Android) ownCloud + Mozilla/5.0 (Android) ownCloud-android/%1$s diff --git a/src/com/owncloud/android/MainApp.java b/src/com/owncloud/android/MainApp.java index 76ecc5e0d7..4c4c906f4d 100644 --- a/src/com/owncloud/android/MainApp.java +++ b/src/com/owncloud/android/MainApp.java @@ -29,6 +29,9 @@ import com.owncloud.android.datamodel.ThumbnailsCacheManager; import com.owncloud.android.lib.common.OwnCloudClientManagerFactory; import com.owncloud.android.lib.common.OwnCloudClientManagerFactory.Policy; import com.owncloud.android.lib.common.utils.Log_OC; + +import org.apache.commons.codec.StringEncoder; + /** * Main Application of the project * @@ -131,14 +134,14 @@ public class MainApp extends Application { try { pInfo = getAppContext().getPackageManager().getPackageInfo(packageName, 0); if (pInfo != null) { - version = "/" + pInfo.versionName; + version = pInfo.versionName; } } catch (PackageManager.NameNotFoundException e) { Log_OC.e(TAG, "Trying to get packageName", e.getCause()); } - // Mozilla/5.0 (Android) ownCloud /1.7.0 - String userAgent = appString + version; + // Mozilla/5.0 (Android) ownCloud-android/1.7.0 + String userAgent = String.format(appString, version); return userAgent; }