vocadb icon indicating copy to clipboard operation
vocadb copied to clipboard

Updating user fails if user has special characters in email

Open riipah opened this issue 4 years ago • 3 comments

When updating user (User/Edit)

System.FormatException The specified string is not in the form required for an e-mail address. Int32 ReadCfwsAndThrowIfIncomplete(System.String, Int32)    at System.Net.Mail.MailAddressParser.ReadCfwsAndThrowIfIncomplete(String data, Int32 index)
   at System.Net.Mail.MailAddressParser.ParseDomain(String data, Int32& index)
   at System.Net.Mail.MailAddressParser.ParseAddress(String data, Boolean expectMultipleAddresses, Int32& index)
   at System.Net.Mail.MailAddressParser.ParseAddress(String data)
   at System.Net.Mail.MailAddress..ctor(String address, String displayName, Encoding displayNameEncoding)
   at VocaDb.Model.Database.Queries.UserQueries.<>c__DisplayClass76_0.<UpdateUser>b__1(IDatabaseContext`1 session, User user) in C:\Sites\UtaiteDB\web\VocaDbModel\Database\Queries\UserQueries.cs:line 0

User's email has a dot.

riipah avatar Sep 03 '20 20:09 riipah

I tried to fix this issue but in vain. Could you please provide me more details?

ycanardeau avatar Oct 11 '20 09:10 ycanardeau

I can't reproduce it either now with the dot. But if you enter for example email "miku" without @, then it will throw unhandled exception from MailAddressNormalizer.Normalize. Maybe you could add a try/catch to that?

riipah avatar Oct 11 '20 10:10 riipah

Thank you for your help. Could you please review this PR just in case?

ycanardeau avatar Oct 11 '20 13:10 ycanardeau

This issue seems to be resolved.

FinnRG avatar May 22 '23 21:05 FinnRG