From 46aa2b89c34db3e31f6aa373964a4ab767bf900a Mon Sep 17 00:00:00 2001 From: tastytea Date: Tue, 29 May 2018 15:03:04 +0200 Subject: [PATCH] Bugfix: Made sure that the first parameter has a leading '?' --- CMakeLists.txt | 2 +- src/url.cpp | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4897436..8104916 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required (VERSION 3.7) project (expandurl-mastodon - VERSION 0.9.0 + VERSION 0.9.1 LANGUAGES CXX ) diff --git a/src/url.cpp b/src/url.cpp index c1b9977..7b1bf74 100644 --- a/src/url.cpp +++ b/src/url.cpp @@ -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; }