nus-cs2103-AY2223S2 / pe-dev-response

1 stars 0 forks source link

Email with short domain sublabel containing hyphen not accepted #2063

Open nus-pe-bot opened 1 year ago

nus-pe-bot commented 1 year ago

Based on the given constraints, the following email address fulfills all 3: donkey@az.a-a

as it ends with domain label "a-a" which is more than 2 characters, has each label "az" and "a-a" start with alphanumeric characters, has each label "az" and "a-a" consist of alphanumeric characters separated only by hyphens if any.

Yet it is rejected by the program. Seems to be an unhandled edge case, probably quite rare but might prevent a person with such an email from being entered into the app completely.

image.png


[original: nus-cs2103-AY2223S2/pe-interim#1688] [original labels: type.FunctionalityBug severity.Medium]

KS2499 commented 1 year ago

Team's Response

There was an issue with the regex we inherited from AB3 under /src/main/java/seedu/quickcontacts/model/person/Email.java The problem is in the DOMAIN_PART_REGEX pattern, which matches each domain label. The pattern allows each label to start and end with an alphanumeric character, but it doesn't allow the label to contain any alphanumeric characters in between if there is a hyphen. This means that valid domain labels like "a-b" or "a-1-b" are rejected.

Duplicate status (if any):

--