Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

/lookup requests don't seem to work #153

Open
anoadragon453 opened this issue May 4, 2019 · 0 comments
Open

/lookup requests don't seem to work #153

anoadragon453 opened this issue May 4, 2019 · 0 comments

Comments

@anoadragon453
Copy link
Member

/lookup doesn't seem to work while /bulk_lookup does.

/lookup pulls an sgAssoc from the DB while /bulk_lookup just pulls an MXID associated with a address. An sgAssoc looks like the following:

{
  "address": "louise@bobs.burgers",
  "medium": "email",
  "mxid": "@ears:matrix.org",
  "not_before": 1428825849161,
  "not_after": 4582425849161,
  "ts": 1428825849161,
  "signatures": {
    "matrix.org": {
      "ed25519:0": "ENiU2YORYUJgE6WBMitU0mppbQjidDLanAusj8XS2nVRHPu+0t42OKA/r6zV6i2MzUbNQ3c3MiLScJuSsOiVDQ"
    }
  }
}

/lookup grabs an assoc from the DB with the following code:

sgassoc = globalAssocStore.signedAssociationStringForThreepid(medium, address)

Which calls this SQL:

def signedAssociationStringForThreepid(self, medium, address):
cur = self.sydent.db.cursor()
# We treat address as case-insensitive because that's true for all the threepids
# we have currently (we treat the local part of email addresses as case insensitive
# which is technically incorrect). If we someday get a case-sensitive threepid,
# this can change.
res = cur.execute("select sgAssoc from global_threepid_associations where "
"medium = ? and lower(address) = lower(?) and notBefore < ? and notAfter > ? "
"order by ts desc limit 1",
(medium, address, time_msec(), time_msec()))
row = res.fetchone()
if not row:
return None
sgAssocBytes = row[0]
return sgAssocBytes

My hunch is sgAssocs aren't getting properly added to the DB.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant