[Content] Additional check for uri conversion
authorPiotr Kosko <p.kosko@samsung.com>
Thu, 18 Jun 2015 06:57:40 +0000 (08:57 +0200)
committerPiotr Kosko <p.kosko@samsung.com>
Thu, 18 Jun 2015 07:16:42 +0000 (09:16 +0200)
[Verification] Code compiles without errors.
  find() with contentURI filter works fine.
  TCT passrate 100%.

Change-Id: I9994a6b8b8fbfdaaa14bcf07aba5c83bad06abdf
Signed-off-by: Piotr Kosko <p.kosko@samsung.com>
src/content/content_filter.cc

index a962c3ab41e3a24f6f16e5417f46b559e8d822eb..0d502b2fec3ac62db047da3e880f38cc1d907080 100755 (executable)
@@ -141,8 +141,12 @@ PlatformResult ContentFilter::BuildQuery(const picojson::object& jsFilter,
           matchValue = "4";
         }
       } else if (name == "contentURI") {
-        //simple convertion of URI to globalpath
-        matchValue = matchValue.substr(strlen("file://"));
+        const char* uri_prefix = "file://";
+        size_t found = matchValue.find(uri_prefix);
+        if (found != std::string::npos) {
+          //simple convertion of URI to globalpath
+          matchValue = matchValue.substr(found + strlen(uri_prefix));
+        }
       }
       switch (match_flag) {
         case AttributeMatchFlag::kStartsWith :