aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--xbmc/URL.cpp5
-rw-r--r--xbmc/test/TestURL.cpp7
2 files changed, 11 insertions, 1 deletions
diff --git a/xbmc/URL.cpp b/xbmc/URL.cpp
index 8bc0f98c7f..b934e7569e 100644
--- a/xbmc/URL.cpp
+++ b/xbmc/URL.cpp
@@ -471,8 +471,11 @@ std::string CURL::GetWithoutOptions() const
std::string strGet = GetWithoutFilename();
// Prevent double slash when concatenating host part and filename part
- if (m_strFileName.size() && (m_strFileName[0] == '/' || m_strFileName[0] == '\\') && URIUtils::HasSlashAtEnd(strGet))
+ if (!m_strFileName.empty() && (m_strFileName[0] == '/' || m_strFileName[0] == '\\') &&
+ URIUtils::HasSlashAtEnd(strGet) && !(IsProtocol("http") || IsProtocol("https")))
+ {
URIUtils::RemoveSlashAtEnd(strGet);
+ }
return strGet + m_strFileName;
}
diff --git a/xbmc/test/TestURL.cpp b/xbmc/test/TestURL.cpp
index e74d3be009..16971eebf5 100644
--- a/xbmc/test/TestURL.cpp
+++ b/xbmc/test/TestURL.cpp
@@ -70,3 +70,10 @@ const TestURLGetWithoutUserDetailsData values[] = {
};
INSTANTIATE_TEST_SUITE_P(URL, TestURLGetWithoutUserDetails, ValuesIn(values));
+
+TEST(TestURLGetWithoutOptions, PreserveSlashesBetweenProtocolAndPath)
+{
+ std::string url{"https://example.com//stream//example/index.m3u8"};
+ CURL input{url};
+ EXPECT_EQ(input.GetWithoutOptions(), url);
+}