summaryrefslogtreecommitdiff
path: root/internal/federation/dereferencing/status.go
diff options
context:
space:
mode:
authorLibravatar tobi <31960611+tsmethurst@users.noreply.github.com>2024-07-26 13:11:07 +0200
committerLibravatar GitHub <noreply@github.com>2024-07-26 13:11:07 +0200
commitecfea10e359b9c9e7c0e6b5fd092e3caa5587df6 (patch)
treecc5cb01cf7d97baf7e47bb7a246fbc392c41fe9e /internal/federation/dereferencing/status.go
parent[feature] Federate interaction policies + Accepts; enforce policies (#3138) (diff)
downloadgotosocial-ecfea10e359b9c9e7c0e6b5fd092e3caa5587df6.tar.xz
[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
Diffstat (limited to 'internal/federation/dereferencing/status.go')
-rw-r--r--internal/federation/dereferencing/status.go21
1 files changed, 17 insertions, 4 deletions
diff --git a/internal/federation/dereferencing/status.go b/internal/federation/dereferencing/status.go
index 88746fc3a..fa9906066 100644
--- a/internal/federation/dereferencing/status.go
+++ b/internal/federation/dereferencing/status.go
@@ -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(),
)
}