Skip to content

Commit e1d9c13

Browse files
committed
URL-encode spaces as %20 in picon HTTP request URLs
When fetching picons from the web interface, channel names containing spaces were used as-is in the HTTP URL, causing 400 Bad Request errors. URL-encode spaces as %20 in both code paths: - Channel::CreateIconPath() (UseOnlinePicons without OpenWebIf path) - Channels::LoadChannelsExtraData() (UseOpenWebIfPiconPath) - Bump version to 22.3.6 and add changelog entry
1 parent 30efd53 commit e1d9c13

4 files changed

Lines changed: 12 additions & 3 deletions

File tree

pvr.vuplus/addon.xml.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<addon
33
id="pvr.vuplus"
4-
version="22.3.5"
4+
version="22.3.6"
55
name="Enigma2 Client"
66
provider-name="Joerg Dembski and Ross Nicholson">
77
<requires>@ADDON_DEPENDS@

pvr.vuplus/changelog.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
v22.3.6
2+
- Fix picon HTTP requests failing with 400 Bad Request when channel names contain spaces (URL-encode spaces as %20)
3+
14
v22.3.4
25
- Translations updates from Weblate
36
- af_za, am_et, ar_sa, ast_es, az_az, be_by, bg_bg, bs_ba, ca_es, cs_cz, cy_gb, da_dk, de_de, el_gr, en_au, en_nz, en_us, eo, es_ar, es_es, es_mx, et_ee, eu_es, fa_af, fa_ir, fi_fi, fo_fo, fr_ca, fr_fr, gl_es, he_il, hi_in, hr_hr, hu_hu, hy_am, id_id, is_is, it_it, ja_jp, ko_kr, lt_lt, lv_lv, mi, mk_mk, ml_in, mn_mn, ms_my, mt_mt, my_mm, nb_no, nl_nl, pl_pl, prs, pt_br, pt_pt, ro_ro, ru_ru, si_lk, sk_sk, sl_si, sq_al, sr_rs, sr_rs@latin, sv_se, szl, ta_in, te_in, tg_tj, th_th, tr_tr, uk_ua, uz_uz, vi_vn, zh_cn, zh_tw

src/enigma2/Channels.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,9 @@ int Channels::LoadChannelsExtraData(const std::shared_ptr<enigma2::data::Channel
345345
{
346346
std::string connectionURL = m_settings->GetConnectionURL();
347347
connectionURL = connectionURL.substr(0, connectionURL.size() - 1);
348-
channel->SetIconPath(StringUtils::Format("%s%s", connectionURL.c_str(), jsonChannel["picon"].get<std::string>().c_str()));
348+
std::string piconPath = jsonChannel["picon"].get<std::string>();
349+
StringUtils::Replace(piconPath, " ", "%20");
350+
channel->SetIconPath(StringUtils::Format("%s%s", connectionURL.c_str(), piconPath.c_str()));
349351

350352
Logger::Log(LEVEL_DEBUG, "%s For Channel %s, using OpenWebPiconPath: %s", __func__, jsonChannel["servicename"].get<std::string>().c_str(), channel->GetIconPath().c_str());
351353
}

src/enigma2/data/Channel.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,11 @@ std::string Channel::CreateIconPath(const std::string& commonServiceReference)
181181
std::replace(iconPath.begin(), iconPath.end(), ':', '_');
182182

183183
if (m_settings->UseOnlinePicons())
184-
iconPath = StringUtils::Format("%spicon/%s.png", m_settings->GetConnectionURL().c_str(), iconPath.c_str());
184+
{
185+
std::string encodedPath = iconPath;
186+
StringUtils::Replace(encodedPath, " ", "%20");
187+
iconPath = StringUtils::Format("%spicon/%s.png", m_settings->GetConnectionURL().c_str(), encodedPath.c_str());
188+
}
185189
else
186190
iconPath = m_settings->GetIconPath().c_str() + iconPath + ".png";
187191

0 commit comments

Comments
 (0)