#7856 Error looking up user by email address when email is invalid

v1.3.0
closed
General
Heith Seewald
2015-08-20
2015-03-18
No

With an author header like this: Author: foobar@gmail.com <foobar@gmail.com@a9fa2536-c6e1-c3a1-1ef2-e4143cdeeb22> you get this error:

  File "/var/local/allura/Allura/allura/model/repository.py", line 943, in authored_user
    return User.by_email_address(self.authored.email)
  File "/var/local/allura/Allura/allura/model/auth.py", line 647, in by_email_address
    addrs = EmailAddress.find(dict(email=addr, confirmed=True))
  File "/var/local/allura/Allura/allura/model/auth.py", line 144, in find
    email = cls.canonical(q['email'])
  File "/var/local/allura/Allura/allura/model/auth.py", line 172, in canonical
    user, domain = addr.split('@')
ValueError: too many values to unpack

This can cause a repo import to fail. We should handle it better.

Discussion

  • Dave Brondsema

    Dave Brondsema - 2015-04-06
    • labels: --> sf-current, sf-1
     
  • Dave Brondsema

    Dave Brondsema - 2015-04-06

    Simple fix could be for canonical to return the provided email address if it isn't an expected format (too many @s)

     
  • Igor Bondarenko - 2015-04-08
    • Owner: Anonymous --> Igor Bondarenko
    • Labels: sf-current, sf-1 --> 42cc, sf-current, sf-1
    • Status: open --> in-progress
     
  • Igor Bondarenko - 2015-04-15
    • status: in-progress --> review
     
  • Igor Bondarenko - 2015-04-15

    Closed #753. ib/7856

     
  • Heith Seewald - 2015-04-15
    • Reviewer: Heith Seewald
     
  • Heith Seewald - 2015-04-20

    So as it is now:

    The test on line 104 asserts the input email 'I Am Nobody <nobody@example.com>' outputs to 'nobody@example.com'.

    So shouldn't the test at 108 also return only the address? i.e. 'I Am@Nobody <nobody@example.com> output to nobody@example.com

     
    • Igor Bondarenko - 2015-04-21

      Hm.. probably you're right. Seems like regexp does not catch this, but I don't see why immediately. I'll investigate more.

       
  • Heith Seewald - 2015-04-20
    • status: review --> in-progress
     
  • Igor Bondarenko - 2015-04-21
    • status: in-progress --> review
     
  • Igor Bondarenko - 2015-04-21

    Closed #757. Force-pushed ib/7856 (rebase)

    Email regex didn't expect whitespace symbols in the end of the string. Fixed and expanded test.

     

    Last edit: Igor Bondarenko 2015-04-21
  • Heith Seewald - 2015-04-21
    • status: review --> closed
     
  • Heith Seewald - 2015-04-21

    Looks good, thanks Igor.

     
  • Dave Brondsema

    Dave Brondsema - 2015-04-30
    • labels: 42cc, sf-current, sf-1 --> 42cc, sf-1
     
  • Igor Bondarenko - 2015-06-18
    • Milestone: unreleased --> asf_release_1.3.0
     

Log in to post a comment.