From af2d60f5a559811f9178cee88ee457c79c4a8578 Mon Sep 17 00:00:00 2001 From: Piotr Kosko Date: Thu, 18 Jun 2015 08:57:40 +0200 Subject: [PATCH] [Content] Additional check for uri conversion [Verification] Code compiles without errors. find() with contentURI filter works fine. TCT passrate 100%. Change-Id: I9994a6b8b8fbfdaaa14bcf07aba5c83bad06abdf Signed-off-by: Piotr Kosko --- src/content/content_filter.cc | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/content/content_filter.cc b/src/content/content_filter.cc index a962c3ab..0d502b2f 100755 --- a/src/content/content_filter.cc +++ b/src/content/content_filter.cc @@ -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 : -- 2.34.1