fentiger,

Oh, joy: it turns out that Go's net/url package doesn't understand that DID URLs can have paths.

Parsing "https://example.social/path/to/object" gives me a useful result:

&url.URL{<br></br>    Scheme:"https",<br></br>    Opaque:"",<br></br>    Host:"example.social",<br></br>    Path:"/path/to/object",<br></br>    [...]<br></br>}

But parsing "did:ap: key:z6abcdef/path/to/object" gives me this:

&url.URL{<br></br>    Scheme:"did",<br></br>    Opaque:"ap:key:z6abcdef/path/to/object",<br></br>    Host:"",<br></br>    Path:"",<br></br>    [...]<br></br>}

So I need some kind of wrapper to detect DID URLs and parse the paths out of them. That's easy enough, I suppose, but then I need to actually use that wrapper, in all the relevant places...

#ActivityPub #FediDev #BangHeadHere

mariusor,
@mariusor@metalhead.club avatar

@fentiger I think the RFC shows something like this for how URIs w/o authority get parsed to components:

https://datatracker.ietf.org/doc/html/rfc3986#section-3

mariusor,
@mariusor@metalhead.club avatar

@fentiger and the net/url documentation expresses the problem directly in the URL section:
> URLs that do not start with a slash after the scheme are interpreted as:
>
> scheme:opaque[?query][]

https://pkg.go.dev/net/url#URL

  • All
  • Subscribed
  • Moderated
  • Favorites
  • random
  • DreamBathrooms
  • ngwrru68w68
  • cisconetworking
  • magazineikmin
  • thenastyranch
  • rosin
  • khanakhh
  • osvaldo12
  • Youngstown
  • slotface
  • Durango
  • kavyap
  • InstantRegret
  • GTA5RPClips
  • JUstTest
  • ethstaker
  • modclub
  • anitta
  • cubers
  • everett
  • tacticalgear
  • mdbf
  • tester
  • provamag3
  • Leos
  • normalnudes
  • megavids
  • lostlight
  • All magazines