Bugfix: Made sure that the first parameter has a leading '?'

This commit is contained in:
tastytea 2018-05-29 15:03:04 +02:00
parent f3db10dc0a
commit 46aa2b89c3
Signed by: tastytea
GPG Key ID: 59346E0EA35C67E5
2 changed files with 9 additions and 1 deletions

View File

@ -1,6 +1,6 @@
cmake_minimum_required (VERSION 3.7)
project (expandurl-mastodon
VERSION 0.9.0
VERSION 0.9.1
LANGUAGES CXX
)

View File

@ -89,6 +89,14 @@ const string strip(const string &url)
(*it).asString());
}
// If '&' is found in the new URL, but no '?'
if (newurl.find('&') != std::string::npos &&
newurl.find('?') == std::string::npos)
{
size_t pos = newurl.find('&');
newurl.replace(pos, 1, "?");
}
return newurl;
}