From 9d97b6b9440984e0b8d3171ab603c06bfc2189e5 Mon Sep 17 00:00:00 2001 From: hailey Date: Sat, 2 Aug 2025 11:55:15 -0700 Subject: [PATCH] fix typo in wellknown url (#24) --- identity/identity.go | 6 +++--- identity/passport.go | 1 - 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/identity/identity.go b/identity/identity.go index ca945d7..3f422f8 100644 --- a/identity/identity.go +++ b/identity/identity.go @@ -33,7 +33,7 @@ func ResolveHandleFromTXT(ctx context.Context, handle string) (string, error) { } func ResolveHandleFromWellKnown(ctx context.Context, cli *http.Client, handle string) (string, error) { - ustr := fmt.Sprintf("https://%s/.well=known/atproto-did", handle) + ustr := fmt.Sprintf("https://%s/.well-known/atproto-did", handle) req, err := http.NewRequestWithContext( ctx, "GET", @@ -92,8 +92,8 @@ func ResolveHandle(ctx context.Context, cli *http.Client, handle string) (string func DidToDocUrl(did string) (string, error) { if strings.HasPrefix(did, "did:plc:") { return fmt.Sprintf("https://plc.directory/%s", did), nil - } else if strings.HasPrefix(did, "did:web:") { - return fmt.Sprintf("https://%s/.well-known/did.json", strings.TrimPrefix(did, "did:web:")), nil + } else if after, ok := strings.CutPrefix(did, "did:web:"); ok { + return fmt.Sprintf("https://%s/.well-known/did.json", after), nil } else { return "", fmt.Errorf("did was not a supported did type") } diff --git a/identity/passport.go b/identity/passport.go index a8ab36b..7bfaf28 100644 --- a/identity/passport.go +++ b/identity/passport.go @@ -46,7 +46,6 @@ func (p *Passport) FetchDoc(ctx context.Context, did string) (*DidDoc, error) { } } - // TODO: should coalesce requests here doc, err := FetchDidDoc(ctx, p.h, did) if err != nil { return nil, err -- 2.51.2