@@ -170,7 +170,7 @@ def test_missing_zim_paths(
170170 "foo.html?foo=bar" ,
171171 RewriteResult (
172172 "https://kiwix.org/a/article/foo.html?foo=bar" ,
173- "foo.html%3Ffoo%3Dbar " ,
173+ "foo.html%3Ffoo=bar " ,
174174 ZimPath ("kiwix.org/a/article/foo.html?foo=bar" ),
175175 ),
176176 ["kiwix.org/a/article/foo.html?foo=bar" ],
@@ -181,7 +181,7 @@ def test_missing_zim_paths(
181181 "foo.html?foo=b%24ar" ,
182182 RewriteResult (
183183 "https://kiwix.org/a/article/foo.html?foo=b%24ar" ,
184- "foo.html%3Ffoo%3Db %24ar" ,
184+ "foo.html%3Ffoo=b %24ar" ,
185185 ZimPath ("kiwix.org/a/article/foo.html?foo=b$ar" ),
186186 ),
187187 ["kiwix.org/a/article/foo.html?foo=b$ar" ],
@@ -192,7 +192,7 @@ def test_missing_zim_paths(
192192 "foo.html?foo=b%3Far" , # a query string with an encoded ? char in value
193193 RewriteResult (
194194 "https://kiwix.org/a/article/foo.html?foo=b%3Far" ,
195- "foo.html%3Ffoo%3Db %3Far" ,
195+ "foo.html%3Ffoo=b %3Far" ,
196196 ZimPath ("kiwix.org/a/article/foo.html?foo=b?ar" ),
197197 ),
198198 ["kiwix.org/a/article/foo.html?foo=b?ar" ],
@@ -316,7 +316,7 @@ def test_missing_zim_paths(
316316 "foo?param=value" ,
317317 RewriteResult (
318318 "https://kiwix.org/a/article/foo?param=value" ,
319- "foo%3Fparam%3Dvalue " ,
319+ "foo%3Fparam=value " ,
320320 ZimPath ("kiwix.org/a/article/foo?param=value" ),
321321 ),
322322 ["kiwix.org/a/article/foo?param=value" ],
@@ -327,7 +327,7 @@ def test_missing_zim_paths(
327327 "foo?param=value%2F" ,
328328 RewriteResult (
329329 "https://kiwix.org/a/article/foo?param=value%2F" ,
330- "foo%3Fparam%3Dvalue /" ,
330+ "foo%3Fparam=value /" ,
331331 ZimPath ("kiwix.org/a/article/foo?param=value/" ),
332332 ),
333333 ["kiwix.org/a/article/foo?param=value/" ],
@@ -338,12 +338,26 @@ def test_missing_zim_paths(
338338 "foo?param=value%2Fend" ,
339339 RewriteResult (
340340 "https://kiwix.org/a/article/foo?param=value%2Fend" ,
341- "foo%3Fparam%3Dvalue /end" ,
341+ "foo%3Fparam=value /end" ,
342342 ZimPath ("kiwix.org/a/article/foo?param=value/end" ),
343343 ),
344344 ["kiwix.org/a/article/foo?param=value/end" ],
345345 False ,
346346 ),
347+ (
348+ # regression test for #316: '=' and ',' must not be encoded so that
349+ # e.g. the YouTube JS player can parse its own script URL properly,
350+ # while other reserved characters (e.g. '?') are still encoded
351+ "https://kiwix.org/a/article/document.html" ,
352+ "foo?k=ytembeds.base.en_US,foo.bar" ,
353+ RewriteResult (
354+ "https://kiwix.org/a/article/foo?k=ytembeds.base.en_US,foo.bar" ,
355+ "foo%3Fk=ytembeds.base.en_US,foo.bar" ,
356+ ZimPath ("kiwix.org/a/article/foo?k=ytembeds.base.en_US,foo.bar" ),
357+ ),
358+ ["kiwix.org/a/article/foo?k=ytembeds.base.en_US,foo.bar" ],
359+ False ,
360+ ),
347361 (
348362 "https://kiwix.org/a/article/document.html" ,
349363 "foo/" ,
@@ -393,7 +407,7 @@ def test_missing_zim_paths(
393407 "/foo.html?param=val+ue" ,
394408 RewriteResult (
395409 "https://kiwix.org/foo.html?param=val+ue" ,
396- "../../foo.html%3Fparam%3Dval %20ue" ,
410+ "../../foo.html%3Fparam=val %20ue" ,
397411 ZimPath ("kiwix.org/foo.html?param=val ue" ),
398412 ),
399413 ["kiwix.org/foo.html?param=val ue" ],
0 commit comments