Skip to content

Regex allows email format rejected by Yotpo API #16

@kenjiefx

Description

@kenjiefx

Yotpo mass create order API does not accept this email format: [email protected]

From what I understand, the exportOrderModel.js validates email address in the order and "skips" these orders in the payload so that the entire batch of orders being sent through API won't fail.

However, the regex seems to allow this format, which is inconsistent with the validation on Yotpo's end

const regex = /^\s*([#-\u002D\u002E\u003A-\u0040a-zA-Z0-9_" /\[\\^\{\}]{1,64})@((?:[-a-zA-Z0-9\u00AA\u00B5\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u0100]+\.)+[a-zA-Z\u00AA\u00B5\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u0100]{2,})\s*$/i
console.log(regex.test('[email protected]'))

exports.EMAIL_VALIDATION_REGEX_FOR_YOTPO_DATA = /^\s*([#-\u002D\u002E\u003A-\u0040a-zA-Z0-9_" /\[\\^\{\}]{1,64})@((?:[-a-zA-Z0-9\u00AA\u00B5\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u0100]+\.)+[a-zA-Z\u00AA\u00B5\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u0100]{2,})\s*$/i; // eslint-disable-line

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions