mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2024-12-22 18:22:11 +00:00
[chore] improved enrichAccount() logging (#1602)
* slight refactor and improved logging on failed webfinger in enrichAccount() * use correct log format directive --------- Signed-off-by: kim <grufwub@gmail.com>
This commit is contained in:
parent
e397272fe8
commit
d0dee8d0b6
|
@ -156,13 +156,15 @@ func (d *deref) enrichAccount(ctx context.Context, requestUser string, uri *url.
|
|||
// A username was provided so we can attempt a webfinger, this ensures up-to-date accountdomain info.
|
||||
accDomain, accURI, err := d.fingerRemoteAccount(ctx, transport, account.Username, account.Domain)
|
||||
|
||||
if err != nil && account.URI == "" {
|
||||
// this is a new account (to us) with username@domain but failed
|
||||
// webfinger, there is nothing more we can do in this situation.
|
||||
switch {
|
||||
case err != nil && account.URI == "":
|
||||
// this is a new account (to us) with username@domain but failed webfinger, nothing more we can do.
|
||||
return nil, fmt.Errorf("enrichAccount: error webfingering account: %w", err)
|
||||
}
|
||||
|
||||
if err == nil {
|
||||
case err != nil:
|
||||
log.Errorf(ctx, "error webfingering[1] remote account %s@%s: %v", account.Username, account.Domain, err)
|
||||
|
||||
case err == nil:
|
||||
if account.Domain != accDomain {
|
||||
// After webfinger, we now have correct account domain from which we can do a final DB check.
|
||||
alreadyAccount, err := d.db.GetAccountByUsernameDomain(ctx, account.Username, accDomain)
|
||||
|
@ -224,7 +226,11 @@ func (d *deref) enrichAccount(ctx context.Context, requestUser string, uri *url.
|
|||
// Now we have a username we can attempt it, this ensures up-to-date accountdomain info.
|
||||
accDomain, _, err := d.fingerRemoteAccount(ctx, transport, latestAcc.Username, uri.Host)
|
||||
|
||||
if err == nil {
|
||||
switch {
|
||||
case err != nil:
|
||||
log.Errorf(ctx, "error webfingering[2] remote account %s@%s: %v", latestAcc.Username, uri.Host, err)
|
||||
|
||||
case err == nil:
|
||||
// Update account with latest info.
|
||||
latestAcc.Domain = accDomain
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue