Fix the file schema issue 48/164048/1
authorcookie <cookie@samsung.com>
Thu, 19 Oct 2017 06:29:58 +0000 (06:29 +0000)
committercookie <cookie@samsung.com>
Fri, 15 Dec 2017 04:34:30 +0000 (13:34 +0900)
Change-Id: I45584ccbccf7c73016944b91c3fdf2cf9c239642
Signed-off-by: cookie <cookie@samsung.com>
services/WebPageUI/URIEntry.cpp

index 5451755be271eff20b68fe4d3297e18bfbec5f3a..2e6fc23f3d37a713d88ed516631c86a3d83752f8 100755 (executable)
@@ -84,7 +84,7 @@ Evas_Object* URIEntry::getContent()
         elm_entry_single_line_set(m_entry, EINA_TRUE);
         elm_entry_scrollable_set(m_entry, EINA_TRUE);
         elm_entry_input_panel_layout_set(m_entry, ELM_INPUT_PANEL_LAYOUT_URL);
-        elm_entry_input_panel_return_key_type_set(m_entry,ELM_INPUT_PANEL_RETURN_KEY_TYPE_GO);
+        elm_entry_input_panel_return_key_type_set(m_entry, ELM_INPUT_PANEL_RETURN_KEY_TYPE_GO);
         elm_entry_text_style_user_push(m_entry, "DEFAULT='font=Tizen:style=Light font_size=42'");
 
         m_rightIcon = elm_button_add(m_entry_layout);
@@ -197,7 +197,7 @@ void URIEntry::_uri_entry_editing_changed_user(void* data, Evas_Object* /* obj *
     URIEntry* self = reinterpret_cast<URIEntry*>(data);
     std::string entry(elm_entry_markup_to_utf8(elm_entry_entry_get(self->m_entry)));
     self->showCancelIcon();
-    if(entry.find(" ") != std::string::npos)
+    if (entry.find(" ") != std::string::npos)
         return;
     self->uriEntryEditingChangedByUser(std::make_shared<std::string>(entry));
 }
@@ -226,7 +226,7 @@ void URIEntry::focused(void* data, Evas_Object* /* obj */, void* /* event_info *
     } else {
         self->m_entryContextMenuOpen = false;
     }
-    if(self->m_first_click) {
+    if (self->m_first_click) {
         elm_entry_entry_set(self->m_entry, elm_entry_utf8_to_markup(self->m_URI.c_str()));
         elm_entry_select_all(self->m_entry);
         self->m_first_click = false;
@@ -276,18 +276,20 @@ std::string URIEntry::rewriteURI(const std::string& url) const
     boost::regex aboutRegex(R"(^about:[^\s]*$)");
     boost::regex fileRegex(R"(^file:///[^\s]*$)");
     boost::regex myfilesappRegex(R"(^file:///opt/usr/media/[^\s]*$)");
+    boost::regex myfilesappetcRegex(R"(^file:///opt/usr/media/../[^\s]*$)");
 
     if (!url.empty()) {
         if (boost::regex_match(url, urlRegex) ||
-            boost::regex_match(url, myfilesappRegex) ||
+            boost::regex_match(url, aboutRegex) ||
             boost::regex_match(url, chromeRegex) ||
-            boost::regex_match(url, aboutRegex))
+            (boost::regex_match(url, myfilesappRegex) &&
+             !boost::regex_match(url, myfilesappetcRegex))) {
             return url;
-        else if (boost::regex_match(std::string("http://") + url, urlRegex) &&
+        else if (boost::regex_match(std::string("http://") + url, urlRegex) &&
             (!boost::regex_match(url, fileRegex)) &&
-            url.find(".") != std::string::npos)
+            url.find(".") != std::string::npos) {
             return std::string("http://") + url;
-        else {
+        else {
             auto sig = createSearchQuery(url);
             if (!sig) {
                 BROWSER_LOGD("[%s:%d] signal error!", __PRETTY_FUNCTION__, __LINE__);
@@ -388,7 +390,7 @@ void URIEntry::showCancelIcon()
     BROWSER_LOGD("[%s:%d] ", __PRETTY_FUNCTION__, __LINE__);
     m_rightIconType = RightIconType::CANCEL;
     bool isEntryEmpty = elm_entry_is_empty(m_entry);
-    if(!isEntryEmpty)
+    if (!isEntryEmpty)
         showRightIcon("toolbar_input_ic_cancel.png");
     else
         hideRightIcon();
@@ -433,7 +435,7 @@ void URIEntry::hideRightIcon()
 void URIEntry::hideLeftIcon()
 {
     BROWSER_LOGD("[%s:%d] ", __PRETTY_FUNCTION__, __LINE__);
-    elm_object_signal_emit(m_entry_layout,"hide,left,icon", "ui");
+    elm_object_signal_emit(m_entry_layout, "hide,left,icon", "ui");
 }
 
 void URIEntry::showSecureIcon(bool show, bool secure)