summaryrefslogtreecommitdiff
path: root/internal/util/regexes.go
diff options
context:
space:
mode:
authorLibravatar Tobi Smethurst <31960611+tsmethurst@users.noreply.github.com>2021-07-11 16:22:21 +0200
committerLibravatar GitHub <noreply@github.com>2021-07-11 16:22:21 +0200
commit846057f0d696fded87d105dec1245e9ba32763ce (patch)
tree9a4914c07bcf189a3eea0a2c091567c56cdf4963 /internal/util/regexes.go
parentfavourites GET implementation (#95) (diff)
downloadgotosocial-846057f0d696fded87d105dec1245e9ba32763ce.tar.xz
Block/unblock (#96)
* remote + local block logic, incl. federation * improve blocking stuff * fiddle with display of blocked profiles * go fmt
Diffstat (limited to 'internal/util/regexes.go')
-rw-r--r--internal/util/regexes.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/internal/util/regexes.go b/internal/util/regexes.go
index 25d90417c..1ca34708f 100644
--- a/internal/util/regexes.go
+++ b/internal/util/regexes.go
@@ -104,4 +104,9 @@ var (
// from eg /users/example_username/statuses/01F7XT5JZW1WMVSW1KADS8PVDH
// The regex can be played with here: https://regex101.com/r/G9zuxQ/1
statusesPathRegex = regexp.MustCompile(statusesPathRegexString)
+
+ blockPathRegexString = fmt.Sprintf(`^/?%s/(%s)/%s/(%s)$`, UsersPath, usernameRegexString, BlocksPath, ulidRegexString)
+ // blockPathRegex parses a path that validates and captures the username part and the ulid part
+ // from eg /users/example_username/blocks/01F7XT5JZW1WMVSW1KADS8PVDH
+ blockPathRegex = regexp.MustCompile(blockPathRegexString)
)