Mbox.rb replacing underscores with spaces

Something in one of these files is replacing underscores with spaces in email addresses. I’m 99% sure that the one I forked did too, but I’m including my copy in case I did something boneheaded.

https://github.com/pfaffman/discourse/blob/master/script/import_scripts/mbox.rb
https://github.com/pfaffman/discourse/blob/master/script/import_scripts/base.rb
is replacing _ with a space in email addresses.

I can’t find it, and it’s making me crazy. I don’t see that any of the .gsubs could be doing it.

Any ideas where I should look, @eviltrout?

Are you talking about underscores to spaces or spaces to underscores? The title of the topic is different than the body :slight_smile:

I am pretty sure our system does not allow spaces in emails and will replace them, so I wouldn’t be surprised if it uses underscores.

Fixed the title.

Right. That’s what’s bizarre. Emails that have underscores in them are ending up causing errors because the underscores are getting replaced with spaces.

m_smith@gmail.com becomes m smith@gmail.com.

Edit: but it only happens sometimes.

Anyway, I was hoping it was something silly and obvious that I was somehow overlooking. Thanks.

I personally haven’t seen this, but it might depend on the mbox format. If you could provide an example of an email that is messed up and the original input I can take a look and try to figure it out.

1 Like

Thanks, @eviltrout. I’ve added some more debugging messages and will see what I can see.