Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
AdamWr opened this issue Sep 1, 2023 · 0 comments
Closed

Comments

@AdamWr
Copy link
Member

AdamWr commented Sep 1, 2023

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.

@adguard-bot adguard-bot assigned slavaleleka and unassigned maximtop Sep 4, 2023
adguard pushed a commit that referenced this issue Sep 13, 2023
…ge return. #354

Squashed commit of the following:

commit 5c5ff26
Merge: b96602b 514c7fe
Author: Adam Wróblewski <adam@adguard.com>
Date:   Tue Sep 12 14:22:54 2023 +0200

    Merge branch 'master' into fix/AG-25455

commit b96602b
Author: Adam Wróblewski <adam@adguard.com>
Date:   Tue Sep 12 14:20:34 2023 +0200

    Better fix for issue with CRLF

commit 678a302
Author: Adam Wróblewski <adam@adguard.com>
Date:   Wed Sep 6 09:27:57 2023 +0200

    Improve 'm3u-prune' — content is not pruned if contains carriage return
@adguard-bot adguard-bot changed the title Improve 'm3u-prune' — content is not pruned if contains carriage return Improve m3u-prune — content is not pruned if contains carriage return Oct 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants