Skip to content

Improve m3u-prune — content is not pruned if contains carriage return #354

@AdamWr

Description

@AdamWr

For example, if m3u8 file contains carriage return (\r), something like:

#EXTM3U\r\n#EXT-X-VERSION:3\r\n#EXT-X-TARGETDURATION:4\r\n#EXT-X-MEDIA-SEQUENCE:0\r\nhttps://advert.com/foo.mp4

Here:

let lines = text.split(/\n\r|\n|\r/);

when it's "splitted", it adds empty elements to array and it causes that pruning doesn't work.

Example:

'#EXTM3U\r\n#EXT-X-VERSION:3\r\n#EXT-X-TARGETDURATION:4\r\n#EXT-X-MEDIA-SEQUENCE:0\r\nhttps://advert.com/foo.mp4'.split(/\n\r|\n|\r/)
Screenshot

image

Removing empty elements from array should fixes it.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions