You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(webvtt): accept whitespace in cue timing lines - #294
Addresses the whitespace case in #280. A tab before --> and a form feed after it make Vtt::parse reject the whole file. The parser expects exactly one space on each side.
Skip spaces, tabs and form feeds before each timestamp and before the arrow, as specified in the WebVTT cue timing algorithm. The regression test compares the resulting cue, including its identifier, alignment and text, with the same cue written with single spaces. It also checks that a line break or vertical tab cannot join two timestamps.
Tested with cargo test --locked -p webvtt-parser, cargo fmt --check -p webvtt-parser and cargo clippy --locked -p webvtt-parser --all-targets -- -D warnings.
Summary by CodeRabbit
Bug Fixes
Cue timing lines now accept spaces, tabs, or form-feed characters around the start time and --> separator, as well as no whitespace around the separator.
Newlines and vertical tabs between the start time and separator remain invalid.
No actionable comments were generated in the recent review.
Walkthrough
Cue timing parsing now accepts spaces, tabs, form feeds, or no whitespace before the start time and around the --> separator. Tests cover these cases and reject newlines and vertical tabs between the start time and separator.
The parser consumes optional spaces, tabs, and form feeds before the start time and before -->. Tests cover accepted whitespace and rejection of newlines and vertical tabs between the start time and separator.
dmtrKovalenko/fframes#280: The issue reports rejected tabs and form feeds around -->; this change permits those whitespace characters.
Possibly related PRs
dmtrKovalenko/fframes#293: Both changes update parsing behavior in webvtt-parser for cases associated with issue #280.
Suggested reviewers:dmtrkovalenko
Merge Risk: Minimal · up to 03bd1
The parser now accepts tabs, form feeds, or no whitespace around the cue timing separator, matching the WebVTT cue timing algorithm. No actionable merge risk was found.
Pre-merge checks: 4
Check name
Status
Explanation
Description Check
Check skipped - CodeRabbit’s high-level summary is enabled.
Title check
The title "fix(webvtt): accept whitespace in cue timing lines" matches the main change. The raw summary shows parse_cue now accepts spaces, tabs, and form feeds around the start time and the --> separ…
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Full details: Title check
Explanation
The title "fix(webvtt): accept whitespace in cue timing lines" matches the main change. The raw summary shows parse_cue now accepts spaces, tabs, and form feeds around the start time and the --> separator, and a test covers this. The PR objectives describe the same fix for issue #280. The title is specific and concise, and it names the affected component (webvtt) and the type of change (fix).
Finishing Touches
Generate unit tests (beta)
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
File: No configuration file from this repository applied
Commit: Unavailable
Layers: defaults
Review profile: CHILL
Plan: Advanced
Run ID: f9726d3a-8f52-41ca-983f-eb367ab3cd97
Commits
Reviewing files that changed from the base of the PR and between b33f46b and 03bd14d.
Files selected for processing: 2
webvtt-parser/src/lib.rs
webvtt-parser/src/vtt_parser.rs
Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Addresses the whitespace case in #280. A tab before
-->and a form feed after it makeVtt::parsereject the whole file. The parser expects exactly one space on each side.Skip spaces, tabs and form feeds before each timestamp and before the arrow, as specified in the WebVTT cue timing algorithm. The regression test compares the resulting cue, including its identifier, alignment and text, with the same cue written with single spaces. It also checks that a line break or vertical tab cannot join two timestamps.
Tested with
cargo test --locked -p webvtt-parser,cargo fmt --check -p webvtt-parserandcargo clippy --locked -p webvtt-parser --all-targets -- -D warnings.Summary by CodeRabbit
-->separator, as well as no whitespace around the separator.