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.
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
Avoid infinite loop with invalid YEARLY recurrence rule #621
Avoid infinite loop with invalid YEARLY recurrence rule #621
Changes from 1 commit
36a3f3e
377646b
42e16f1
feba263
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could also assert that
completed
is set, while you are at it.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Spec says that
The BYYEARDAY rule part MUST NOT be specified when the FREQ rule part is set to DAILY, WEEKLY, or MONTHLY.
, so this combination should normally be an error instead of just not producing instances.I guess that brings up the bigger question of should we just ignore such errors and be lenient, or should we throw. What about using
ICAL.design.strict
to determine if it should throw or silently show no instances?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The robustness principle suggests to me that we should only error if we reach a point where we simply can't interpret the file any longer. I'd be okay with using
strict
as a guard here if that makes sense to you. Probably the best thing to do in this instance is to favor theFREQ
property and any invalid parts that follow are silently dropped, resulting in occurrences that follow whatever can be validly interpreted. Unfortunately, the spec provides rules for how to create valid iCalendar objects, but no real guidance on how to deal with invalid ones.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, generally I'd like ical.js to be able to parse everything and be lenient. The strict mode was meant for the case where you might use ical.js as a validator and would want it to bail. Let's put this behind the strict mode check.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wasn't quite sure how to access whether we were in strict mode from the recurrence iter, so I've implemented the infinite loop prevention without modifying any throwing behavior. If that behavior is desire, it may be best to address that in a followup.