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

Ignore multiple same parameter-values #577

Merged
merged 2 commits into from
Jul 15, 2022

Conversation

heiglandreas
Copy link
Contributor

Sometimes it seems like parameters can be added multiple times with the same value. Besides not making any sense (and partially being not allowed in the first place) this will also possibly break the further process of parsing an icalendar file.

This modification adds a shortcut when the last parameter-value and the current parameter value are exactly the same. In that case the new value is ignored and only the old value will be used.

The use-case - as documented in the test - is that there seem to be icalendar files that contain the following content:

DTSTART;VALUE=DATE;VALUE=DATE:20220612

While that seems to violate the RFC it is not seen as a violation in the icalendar validator at https://icalendar.org/validator.html and as it can also be imported by other calendaring systems it looks like this should at least not break the parser.

@codecov
Copy link

codecov bot commented Jul 12, 2022

Codecov Report

Merging #577 (404e548) into master (b8a44ea) will increase coverage by 0.00%.
The diff coverage is 100.00%.

@@            Coverage Diff            @@
##             master     #577   +/-   ##
=========================================
  Coverage     98.34%   98.34%           
- Complexity     1887     1888    +1     
=========================================
  Files            71       71           
  Lines          4532     4533    +1     
=========================================
+ Hits           4457     4458    +1     
  Misses           75       75           
Impacted Files Coverage Δ
lib/Parser/MimeDir.php 99.56% <100.00%> (+<0.01%) ⬆️

📣 Codecov can now indicate which changes are the most critical in Pull Requests. Learn more

Sometimes it seems like parameters can be added multiple times with
the same value. Besides not making any sense (and partially being
not allowed in the first place) this will also possibly break the
further process of parsing an icalendar file.

This modification adds a shortcut when the last parameter-value and the
current parameter value are exactly the same. In that case the new
value is ignored and only the old value will be used.

The use-case - as documented in the test - is that there seem to be
icalendar files that contain the following content:

    DTSTART;VALUE=DATE;VALUE=DATE:20220612

While that seems to violate the RFC it is not seen as a violation in
the icalendar validator at https://icalendar.org/validator.html and
as it can also be imported by other calendaring systems it looks like
this should at least not break the parser.
@heiglandreas heiglandreas force-pushed the fixMultipleProperties branch from 5d2e6cb to 85340b7 Compare July 12, 2022 15:22
Copy link
Member

@staabm staabm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thx

@phil-davis phil-davis merged commit 0fdd1d1 into sabre-io:master Jul 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants