[api] Fixed back urls without ://

This commit is contained in:
Alex Zolotarev 2013-07-01 02:25:36 +03:00 committed by Alex Zolotarev
parent f2ca69f776
commit 33e27e5f24
2 changed files with 10 additions and 2 deletions

View file

@ -95,6 +95,10 @@ UNIT_TEST(MapApiPointURLEncoded)
UNIT_TEST(GlobalBackUrl)
{
{
ParsedMapApi api(Uri("mwm://map?ll=1,2&n=PointName&backurl=someTestAppBackUrl"));
TEST_EQUAL(api.GetGlobalBackUrl(), "someTestAppBackUrl://", ());
}
{
ParsedMapApi api(Uri("mwm://map?ll=1,2&n=PointName&backurl=ge0://"));
TEST_EQUAL(api.GetGlobalBackUrl(), "ge0://", ());
@ -125,7 +129,7 @@ UNIT_TEST(GlobalBackUrl)
}
{
ParsedMapApi api(Uri("mwm://map?ll=1,2&n=PointName&backurl=%E6%88%91%E6%84%9Bmapswithme"));
TEST_EQUAL(api.GetGlobalBackUrl(), "我愛mapswithme", ());
TEST_EQUAL(api.GetGlobalBackUrl(), "我愛mapswithme://", ());
}
}

View file

@ -116,7 +116,11 @@ void ParsedMapApi::AddKeyValue(string key, string const & value)
}
else if (key == "backurl")
{
m_globalBackUrl = value;
// Fix missing :// in back url, it's important for iOS
if (value.find("://") == string::npos)
m_globalBackUrl = value + "://";
else
m_globalBackUrl = value;
}
else if (key == "v")
{