[bugfix] Use punycode for host part of resource query param when doing webfinger requests (#3133)

* [bugfix] use punycode when webfingering

* account for punycode when checking if final URI matches expected

* hmm

* fix test
This commit is contained in:
tobi
2024-07-26 13:11:07 +02:00
committed by GitHub
parent 8ab2b19a94
commit ecfea10e35
7 changed files with 239 additions and 13 deletions

View File

@@ -467,13 +467,26 @@ func (d *Dereferencer) enrichStatus(
)
}
// Ensure the final parsed status URI / URL matches
// Ensure the final parsed status URI or URL matches
// the input URI we fetched (or received) it as.
if expect := uri.String(); latestStatus.URI != expect &&
latestStatus.URL != expect {
matches, err := util.URIMatches(
uri,
append(
ap.GetURL(apubStatus), // status URL(s)
ap.GetJSONLDId(apubStatus), // status URI
)...,
)
if err != nil {
return nil, nil, gtserror.Newf(
"error checking dereferenced status uri %s: %w",
latestStatus.URI, err,
)
}
if !matches {
return nil, nil, gtserror.Newf(
"dereferenced status uri %s does not match %s",
latestStatus.URI, expect,
latestStatus.URI, uri.String(),
)
}