[Common] GetRuntimeVariable - removing double quotes from app_id
authorPawel Kaczmarek <p.kaczmarek3@samsung.com>
Mon, 1 Jun 2015 10:23:27 +0000 (12:23 +0200)
committerHyunjin Park <hj.na.park@samsung.com>
Mon, 1 Jun 2015 14:29:32 +0000 (23:29 +0900)
[Info]
Crosswalk has used the double quote for the app_id from the first.
The n-wrt (new wrt) is using the double quote also but that's wrt and wrt-service's bug.
To keep compatibilities, two case of formats should be considered in webapi-plugins.

Change-Id: I69aaa06d5213d3d99f08f6393cf8249d30671346
Signed-off-by: Pawel Kaczmarek <p.kaczmarek3@samsung.com>
src/common/extension.cc

index 096f5ca2fba1419b9e6c9f1dda5f539331219f06..d6e50548814399f791355dc743fdd458a9089d20 100755 (executable)
@@ -145,7 +145,20 @@ std::string Extension::GetRuntimeVariable(const char* var_name, unsigned len) {
 
   std::vector<char> res(len + 1, 0);
   g_runtime->GetRuntimeVariableString(xw_extension_, var_name, &res[0], len);
-  return std::string(res.begin(), res.end());
+  // crosswalk has used the double quote for the app_id from the first.
+  // the n-wrt (new wrt) is using the double quote also.
+  // but that's wrt and wrt-service's bug.
+  // To keep compatibilities, two case of formats should be considered in webapi-plugins.
+  // removing double quote to keep compatibilities with new and old wrt
+  std::string value = std::string(res.begin(), res.end());
+  if (var_name == "app_id" && value.find('"', 0) != std::string::npos
+      && value.find('"', value.size() -1) != std::string::npos) {
+
+    value = value.erase(0, 1);
+    value = value.erase(value.size() - 1, 1);
+  }
+
+  return value;
 }
 
 // static