summaryrefslogtreecommitdiff
path: root/internal/util/uri.go
diff options
context:
space:
mode:
authorLibravatar Tobi Smethurst <31960611+tsmethurst@users.noreply.github.com>2021-06-26 16:21:40 +0200
committerLibravatar GitHub <noreply@github.com>2021-06-26 16:21:40 +0200
commitb6c62309f236410a2dabdcf254473be99d7e60a7 (patch)
tree88982f7b25dffdc5b3f4bfaac0de241752c1815d /internal/util/uri.go
parentqad getting started guide (#63) (diff)
downloadgotosocial-b6c62309f236410a2dabdcf254473be99d7e60a7.tar.xz
separate public key handler (#64)
Diffstat (limited to 'internal/util/uri.go')
-rw-r--r--internal/util/uri.go7
1 files changed, 6 insertions, 1 deletions
diff --git a/internal/util/uri.go b/internal/util/uri.go
index 7d4892960..2bfdd6c40 100644
--- a/internal/util/uri.go
+++ b/internal/util/uri.go
@@ -140,7 +140,7 @@ func GenerateURIsForAccount(username string, protocol string, host string) *User
followingURI := fmt.Sprintf("%s/%s", userURI, FollowingPath)
likedURI := fmt.Sprintf("%s/%s", userURI, LikedPath)
collectionURI := fmt.Sprintf("%s/%s/%s", userURI, CollectionsPath, FeaturedPath)
- publicKeyURI := fmt.Sprintf("%s#%s", userURI, PublicKeyPath)
+ publicKeyURI := fmt.Sprintf("%s/%s", userURI, PublicKeyPath)
return &UserURIs{
HostURL: hostURL,
@@ -209,6 +209,11 @@ func IsStatusesPath(id *url.URL) bool {
return statusesPathRegex.MatchString(id.Path)
}
+// IsPublicKeyPath returns true if the given URL path corresponds to eg /users/example_username/main-key
+func IsPublicKeyPath(id *url.URL) bool {
+ return userPublicKeyPathRegex.MatchString(id.Path)
+}
+
// ParseStatusesPath returns the username and ulid from a path such as /users/example_username/statuses/SOME_ULID_OF_A_STATUS
func ParseStatusesPath(id *url.URL) (username string, ulid string, err error) {
matches := statusesPathRegex.FindStringSubmatch(id.Path)