vobject icon indicating copy to clipboard operation
vobject copied to clipboard

Improve error checks in Mimedir parser

Open KristofferFM opened this issue 7 months ago • 1 comments

The Mimedir parser has a general flaw which is it simply ignores tokens it doesn't recognize.

As an example, the following property is invalid according to the specifications, and should be rejected by the parser.

FN;P1=value1; P2=value2:value

The problem is a whitespace in front of parameter name P2, which is not allowed according to the grammar described here . However, the current Mimedir parser do accept the line and furthermore misinterprets it to be on this format:

FN;P1=value1,value2:value

This pull request solves this specific problem by introducing the possibility to look back on the previous token parsed. Maybe it can be further improved by adding more checks. However a more general solution should possibly be preferred, I guess a complete rewrite of the parser could be the best solution.

KristofferFM avatar Sep 08 '25 12:09 KristofferFM

Codecov Report

:white_check_mark: All modified and coverable lines are covered by tests. :white_check_mark: Project coverage is 98.78%. Comparing base (96c3152) to head (25a6731). :warning: Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff            @@
##             master     #727   +/-   ##
=========================================
  Coverage     98.78%   98.78%           
- Complexity     1877     1879    +2     
=========================================
  Files            71       71           
  Lines          5274     5282    +8     
=========================================
+ Hits           5210     5218    +8     
  Misses           64       64           

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

:rocket: New features to boost your workflow:
  • :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

codecov[bot] avatar Sep 08 '25 12:09 codecov[bot]