Quantcast
Channel: ImapX 2
Viewing all articles
Browse latest Browse all 1952

Commented Unassigned: Opening closing bracket () logic to NormalizeAndProcessFetchResultseems incorrect [1907]

$
0
0
Pavel,

In Message.NormalizeAndProcessFetchResult function the parameter list has headers, in my case the subject header is divided into two items e.g.

1. This is my subject with opening bracket ( in it
2. Closing bracket ) is here

While parsing the item 1, the if validation
if ((str.Split('(').Length - (i == 0 ? 1 : 0)) >= (str.Split(')').Length))

return true, hence ProcessCommandResult(str); is executed.

But when parsing item 2, the if statement returns false and the remaining part of the subject is added to buffer which later is append to other header, hence no headers after subject are actually parsed.

You may want to change it to
if ((str.Split(')').Length + (i == 0 ? 1 : 0)) >= (str.Split('(').Length))

but this will have same issue in case subject only has a opening ( bracket


Hence I have changed it to
if ((str.Split(')').Length + (i == 0 ? 1 : 0)) >= (str.Split('(').Length) || (i + 1 < data.Count && Regex.IsMatch(data[i+1], @"^[A-Za-z-]+:")))

If this look right to you, you may want to correct the same in the code
Comments: ** Comment from web user: pavel_azanov **

Thank you really much! The code is now included. I will do a minor optimization later, the Regex is too slow in this case.

I'd be happy if you can test the latest code from the repository once again with your application.

Greets,

Pavel


Viewing all articles
Browse latest Browse all 1952

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>