Bod has asked for the wisdom of the Perl Monks concerning the following question:

This has absolutely nothing to do with Perl but I know the vast range of knowledge and experience in The Monastery might save me a lot of searching...

A client is using Ecwid e-commerce platform and wants to sent the data to a Go High Level (GHL) CRM. I've set up a webhook that notifies GHL when an order is placed. GHL then calls the Ecwid API to get email address, name, etc. Everything works fine except the email addresses get mutilated in the process!

abc123@example.com -> abc123@example.comabc andrew.test@gmail.com -> andrew.test@gmail.comandrew.test a.test123@example.com -> a.test123@example.coma.test

From the limited dataset I have it appears that everything from the start of the email address to the @ or the first numeric digit is appended to the end of the email address...

Have you ever seen anything like this before?
Do you have any suggestions before I spend too long trying to work out where the problem is and what is causing it, then dealing with two lots of customer support teams who are likely to blame each other.

Replies are listed 'Best First'.
Re: [OT] - Mutilated email addresses (not Perl)
by Polyglot (Chaplain) on Jan 15, 2024 at 21:19 UTC
    I haven't seen anything quite like that before, but it looks to me like something gone awry with an email validation routine, which might be in Javascript if it's executed client-side before form submission. At least, that's where I would look first. Check also that the @ symbol is properly escaped: it has special-symbol use in multiple programming languages beyond Perl. I'd be curious to see what happens to underscores, hyphens, or other email address TLD's like in yahoo.com.tw.

    Sorry, not much help here....

    Blessings,

    ~Polyglot~

      I'd be curious to see what happens to underscores, hyphens, or other email address TLD's like in yahoo.com.tw

      From the small sample dataset, the TLD appears to make no difference. But being in the UK means I am only likely to see .com .co.uk and .net. I shall keep an eye out for new domains appearing and check the behaviour.

      I've had another look now there's a bit more data. The truncation happens at both underscores and hyphens...

      chirl-loydayls@hotmail.co.uk -> chirl-loydayls@hotmail.co.ukchirl t_gilbro@hotmail.com -> t_gilbro@hotmail.comt

      The above have been modified from the actual email addresses!

      However, I don't have any access to the code on either server.

        I'd suspect that the bit being duplicated/appended is /^([a-z.]+)/i. That is, alpha and dot. Which kinda looks like someone's naive take on what domain names — and user names — can look like.

        If so, then you can strip off that extraneous bit with something like: s/^(([a-z.]+).*)\2$/\1/

      which might be in Javascript if it's executed client-side before form submission

      There is no 'client' to run Javascript and no form...

      One server sends a JSON object to the other as an API request. The other server sends a JSON object back to the first server. Fully automated with no human interaction.