mirror of
https://github.com/iptv-org/iptv.git
synced 2026-11-16 21:32:15 +02:00
fix: keep %20, %2F and %23 encoded when playlist:format normalizes links
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
#EXTM3U
|
||||
#EXTINF:-1 tvg-id="",Example Path Space (720p)
|
||||
http://example.com/TVP%20Wilno%20HD/index.m3u8
|
||||
#EXTINF:-1 tvg-id="",Example Path Slash (720p)
|
||||
http://example.com/a%2Fb/index.m3u8
|
||||
#EXTINF:-1 tvg-id="",Example Query Hash (720p)
|
||||
http://example.com/index.m3u8?id=1%232
|
||||
@@ -54,6 +54,20 @@ describe('playlist:format', () => {
|
||||
'http://example.com/a%ZZ'
|
||||
)
|
||||
})
|
||||
|
||||
it('keeps percent escapes whose decoding would change the link', () => {
|
||||
fs.emptyDirSync('tests/__data__/output')
|
||||
fs.copySync('tests/__data__/input/playlist_normalize', 'tests/__data__/output/streams')
|
||||
|
||||
const cmd =
|
||||
'cross-env STREAMS_DIR=tests/__data__/output/streams DATA_DIR=tests/__data__/input/data npm run playlist:format'
|
||||
execSync(cmd, { encoding: 'utf8' })
|
||||
|
||||
const output = content('tests/__data__/output/streams/reserved_escapes.m3u')
|
||||
expect(output).toContain('http://example.com/TVP%20Wilno%20HD/index.m3u8')
|
||||
expect(output).toContain('http://example.com/a%2Fb/index.m3u8')
|
||||
expect(output).toContain('http://example.com/index.m3u8?id=1%232')
|
||||
})
|
||||
})
|
||||
|
||||
function content(filepath: string) {
|
||||
|
||||
Reference in New Issue
Block a user