Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArsentiy Milchakov <a.milchakov@corp.mail.ru>2016-07-04 19:15:23 +0300
committerArsentiy Milchakov <a.milchakov@corp.mail.ru>2016-07-04 19:15:23 +0300
commit381db9f24d2028fcbc9d86ad13608616801c2cf8 (patch)
treeb0df46a21d759b0fa07677106e145b38f697f35d /indexer/editable_map_object.cpp
parent5015a517216a2e8504b05c2ba2e745d44d3606c1 (diff)
double dots in website name is not allowed
Diffstat (limited to 'indexer/editable_map_object.cpp')
-rw-r--r--indexer/editable_map_object.cpp17
1 files changed, 11 insertions, 6 deletions
diff --git a/indexer/editable_map_object.cpp b/indexer/editable_map_object.cpp
index d074f2255a..967bf2764e 100644
--- a/indexer/editable_map_object.cpp
+++ b/indexer/editable_map_object.cpp
@@ -301,9 +301,14 @@ bool EditableMapObject::ValidateWebsite(string const & site)
if (site.empty())
return true;
- auto const dotPos = find(begin(site), end(site), '.');
- // Site should contain at least one dot but not at the begining/and.
- if (dotPos == end(site) || site.front() == '.' || site.back() == '.')
+ // Site should contain at least one dot but not at the begining/end.
+ if ('.' == site.front() || '.' == site.back())
+ return false;
+
+ if (string::npos == site.find("."))
+ return false;
+
+ if (string::npos != site.find(".."))
return false;
return true;
@@ -317,13 +322,13 @@ bool EditableMapObject::ValidateEmail(string const & email)
if (strings::IsASCIIString(email))
return regex_match(email, regex(R"([^@\s]+@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)+$)"));
-
+
if ('@' == email.front() || '@' == email.back())
return false;
-
+
if ('.' == email.back())
return false;
-
+
auto const atPos = find(begin(email), end(email), '@');
if (atPos == end(email))
return false;